Mark: The error in the screenshot (emailed separately), shows:
"The method getRelativeDateTimeString(ResourcesList, long, long, long, int) is undefined for the type" The declaration of my Activity is: Public class ResourcesList extends ListActivity I'm missing something stupid, right? Thanks, Nick Owens VP, ThreeClix Office: (904) 429-7039 Mobile: (847) 565-9392 After Hours: (904) 540-5830 -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Mark Murphy Sent: Wednesday, February 24, 2010 9:51 AM To: [email protected] Subject: Re: [android-developers] FormatDateTime Nick Owens wrote: > Mark: > > Sorry about that, it is. I assumed it had been removed since I am not able > to use getRelativeDateTimeString() in the following: > > ---------------------------------------------------------------------------- > long dateMin = 60000; > long dateMax = (86400000 * 2); > > DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); > > Date date = df.parse(dateTime); > > long when = date.getTime(); > > int flags = 0; > > String finalDateTime = DateUtils.getRelativeDateTimeString(this, (when + > TimeZone.getDefault().getOffset(when)), dateMin, dateMax, flags); > > return finalDateTime; > ---------------------------------------------------------------------------- > > So when it was switched over from a Library to a built-in Class, was this > function removed? Click on the following link: http://developer.android.com/reference/android/text/format/DateUtils.html This is what is known as "JavaDocs", the API documentation for Java classes. Specifically, you are looking at android.text.format.DateUtils, the class you are trying to use. If you scroll down on that page, you will see a table named "Public Methods". This contains a list of public methods available on the class. If you scroll down into that table, you will see six editions of the getRelativeDateTimeString() method, with different parameter sets. Now, I don't know what "this" is in your code snippet. If "this" were a Context (e.g., Activity, Service), then the first method signature would seem to match your parameters. Hence, my best guess is that "this" is not a Context -- fix that, and you should be able to use the method. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _Beginning Android_ from Apress Now Available! -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

