Reader small image

You're reading from  Mastering Android Wear Application Development

Product typeBook
Published inDec 2016
Reading LevelIntermediate
PublisherPackt
ISBN-139781785881725
Edition1st Edition
Languages
Right arrow
Authors (2):
Siddique Hameed
Siddique Hameed
author image
Siddique Hameed

Siddique Hameed is a pragmatic technologist currently working on Simplify Commerce (https://simplify.com), a payment gateway platform from MasterCard. During his diverse career roles, hes been crafting software for Fortune 500 companies to startups of industry domains ranging from finance, commerce, social media, telecom, bioinformatics, publishing, and insurance. He is passionate about technology, software and their effects on day-to-day lives. He is a strong believer in open-source software culture and actively contributes to many opensource projects. On times, he speaks at technology events, meetups, and mentor contestants in hackathons. He likes teaching kids and adults in programming, technology and software development, and volunteers on coding initiatives such as Girls Who Code, Code.org, and STEM (science, technology, engineering, and mathematics) programs. In his spare time, he likes traveling, goes on long road trips, and tinker with Raspberry Pi and build DIY gadgets.
Read more about Siddique Hameed

Javeed Chida
Javeed Chida
author image
Javeed Chida

Javeed Chida currently works as a senior software engineer for Apollo Education Group, a leader in global education. He has worked with several teams over the years developing multi-layered enterprise applications for companies spanning several industries including education, finance, medical, insurance, construction, and legal. He is passionate about Java portals and particularly enthused by the Liferay portal platform. He also has a love for clever and innovative technical documentation. Apart from periodically churning out articles as a highlighted community blogger on Liferay.com. He spends his leisure absorbed in creative writing projects, particularly classical poetry and fiction.
Read more about Javeed Chida

View More author details
Right arrow

The DayOfYearActivity class


The DayOfYearActivity activity is a very simple class that uses Java's default java.util.Calendar instance to calculate how many days have passed and how many days are remaining until the end of the year:

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
import java.util.Calendar;

public class DayOfYearActivity extends Activity 
{
  @Override
  protected void onCreate(Bundle savedInstanceState) 
  {
  super.onCreate(savedInstanceState);         
  setContentView(R.layout.activity_day_of_year);         
  Calendar calendar = Calendar.getInstance();         
  String dayOfYearDesc = getString(R.string.day_of_year_card_desc,                   
    calendar.get(Calendar.DAY_OF_YEAR),  
    calendar.getActualMaximum(Calendar.DAY_OF_YEAR) - 
    calendar.get(Calendar.DAY_OF_YEAR));         
  TextView desc = (TextView) findViewById(R.id.day_of_year_desc);         
  desc.setText(dayOfYearDesc);     
  } 
}

The activity_day_of_year...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Mastering Android Wear Application Development
Published in: Dec 2016Publisher: PacktISBN-13: 9781785881725

Authors (2)

author image
Siddique Hameed

Siddique Hameed is a pragmatic technologist currently working on Simplify Commerce (https://simplify.com), a payment gateway platform from MasterCard. During his diverse career roles, hes been crafting software for Fortune 500 companies to startups of industry domains ranging from finance, commerce, social media, telecom, bioinformatics, publishing, and insurance. He is passionate about technology, software and their effects on day-to-day lives. He is a strong believer in open-source software culture and actively contributes to many opensource projects. On times, he speaks at technology events, meetups, and mentor contestants in hackathons. He likes teaching kids and adults in programming, technology and software development, and volunteers on coding initiatives such as Girls Who Code, Code.org, and STEM (science, technology, engineering, and mathematics) programs. In his spare time, he likes traveling, goes on long road trips, and tinker with Raspberry Pi and build DIY gadgets.
Read more about Siddique Hameed

author image
Javeed Chida

Javeed Chida currently works as a senior software engineer for Apollo Education Group, a leader in global education. He has worked with several teams over the years developing multi-layered enterprise applications for companies spanning several industries including education, finance, medical, insurance, construction, and legal. He is passionate about Java portals and particularly enthused by the Liferay portal platform. He also has a love for clever and innovative technical documentation. Apart from periodically churning out articles as a highlighted community blogger on Liferay.com. He spends his leisure absorbed in creative writing projects, particularly classical poetry and fiction.
Read more about Javeed Chida