Click here to Skip to main content
Sign Up to vote bad
good
See more: JavaAndroid
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 30 Nov '10 - 19:57


2 solutions

Have you looked at java.util.Date[^]?
  Permalink  
I believe something like this would do the trick:
 
Time now = new Time();
CharSequence text = now.format2445();
Toast toast = Toast.makeText(getApplicationContext(), text, Toast.LENGTH_SHORT);
toast.show();
 
Hope this helps,
Fredrik
  Permalink  

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 OriginalGriff 355
1 Sergey Alexandrovich Kryukov 338
2 Arun Vasu 315
3 Maciej Los 208
4 Aarti Meswania 180
0 Sergey Alexandrovich Kryukov 9,755
1 OriginalGriff 7,549
2 CPallini 4,018
3 Rohan Leuva 3,362
4 Maciej Los 2,951


Advertise | Privacy | Mobile
Web01 | 2.6.130523.1 | Last Updated 1 Dec 2010
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid