Ljdawson Ljdawson - 6 months ago 22
Android Question

Inserting the current year into a TextView

Just a small problem really, I want to place the current year into the footer of my apps. Each footer is a TextView, which is seen on menu screens etc. Is there a way to insert the year into this dynamically?



You can do something like:

Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);

TextView footer = findViewById(R.id.footer);
footer.setText("" + year);