Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How do we get the time from an Android phone? Is it possible to display the time in a toast? How to go about doing that? Thanks for the help in advance.
Posted

I believe something like this would do the trick:

Java
Time now = new Time();
CharSequence text = now.format2445();
Toast toast = Toast.makeText(getApplicationContext(), text, Toast.LENGTH_SHORT);
toast.show();


Hope this helps,
Fredrik
 
Share this answer
 
Have you looked at java.util.Date[^]?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900