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?
Cheers, Laurence
for the new line in TextView just add \n in middle of your text it works..
TextView tv1 = (TextView)findViewById(R. id. textView1); tv1. setText("Hello"); setContentView(tv1);
We use attribute android: hint= "Text will show here", so if we will set the TextView in the MainActivity.
You can do something like:
Calendar calendar = Calendar.getInstance(); int year = calendar.get(Calendar.YEAR); TextView footer = findViewById(R.id.footer); footer.setText("" + year);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With