The application needs two separate TextView to display the date and time. I have already tried everything that was able to find on the Internet, for example:
SimpleDateFormat format = new SimpleDateFormat ("dd.mm.yyyy"); textView.settext (format.format (new date ())); DateFormat DF = New SimpleDateFormat ("Eee, D Mmm Yyyy, HH: MM"); String Date = DF.Format (Calendar.getInstance (). GetTime ());
and many more different examples, and as a result – I do not displays anything in textView or flies the application, as an error displays such as problems with the Gregian calendar or something else in this way, well, that is, it shows that the problem is in what A deep class, which is responsible for the function that I call, but I don’t want to put in those classes as I didn’t create them and can break their work with my intervention. If someone came across such issues or knows how to solve mine I will be grateful for the help.
Answer 1, Authority 100%
Both your options must be workers. Go through the code by the debugger, look at what the methods
simpledateformat.format (...) must return the formatted date representation.
Similar option, separate date and time:
// current time Date CurrentDate = New Date (); // Formatting time as "day. Movement DateFormat DateFormat = New SimpleDateFormat ("dd.mm.yyyy", locale.getdefault ()); String DateText = DateFormat.Format (CurrentDate); // Formatting time like "Watches: Minutes: Seconds" DateFormat TimeFormat = New SimpleDateFormat ("HH: MM: SS", Locale.GetDefault ()); STRING TIMETEXT = TIMEFORMAT.FORMAT (CURRENTDATE); TextViewDate.SetText (DateText); TextViewTime.SetText (TimeText);
import java.text.dateformat; Import java.text.simpledateFormat; Import java.util.date; Import java.util.locale;