Answer the question
In order to leave comments, you need to log in
How to calculate how many hours and minutes are left from the time specified in the TextView in an android application?
For example, in TextView1 the time is "14-00" using the current time to calculate how many hours and minutes are left until 14-00 and display it in TextView2. if the time is later than 14-00 write in TextView2 "Your train has left. Today you go home on foot." I can not program, probably Calendar is not suitable for these purposes.
An example code would be nice. Sorry for being rude)
Answer the question
In order to leave comments, you need to log in
At least with your format, you can split on the "-" character and convert the resulting strings to int and count.
If the format is more complicated and you need to take into account days, etc., then you can parse the time using SimpleDateFormat and calculate it using the received time.
+ you can look at DateUtils there are several methods you need. developer.android.com/intl/en/reference/android/te...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question