android - Using SimpleDateFormat to get current date -
i looked intensively on google, , here find code works show current date i've been through few of suggested questions, don't work show current date day app runs. doing same current time. goal able tapping textview of either date, or time, user can change time reflect choose. return date/time chosen , return reflect in textview.
the part need getting current actual date of app being opened, time separately.
here code....
date curdate = new date(); simpledateformat format = new simpledateformat("ee, mm dd, yyyy"); string datetostr = format.format(curdate);
trying output string show in textview work. want show short hand of both day of week, , month. thinking might need locale, not familiar this.
would appreciate date code. or tutorial date can follow. believe can figure out how picker data after user selects date/time, having hard time showing picker when user selects textview. can show via onclicklistener tried google's example of pickers , didn't work. code still came errors getsupportfragmentmanger(). doing of code in fragment, activity. not mistaken fragmentactivity.
i have found answer why date showing 1 day before. although isn't complete answer it's troubleshooting step have ran same problem.
basically when using virtual device. doesn't show accurate date reason. make sure using actual device test on. time show properly.
go --> here, find 1 line coded answer @patrik
however, still need assistance working on time/date pickers, , returning user's response in string set textview. if can that, great. posting separate question regarding different issue. thanks!
Comments
Post a Comment