Ok thanks Ralph.
I have been entering the code and replaced my previous 2 lines.
However what i do not understand is that i suddenly get an error:
"Date date = formatIn.parse(created_time);"
Unhandled Exception: java.text.ParseException < that's my error.
i can't set the "catch" to ParseException because then the rest of the code
stops working.
so the "catch" has to remain JSONException.
i'm struggling with this code for some time now. I am sorry if i ask for
too much help.
On Tuesday, February 23, 2016 at 6:37:05 PM UTC+1, Ralph Bergmann wrote:
>
> Am 23.02.16 um 16:26 schrieb Mark van Limburg:
> > According to the earlier pasted Class file, where would you paste the
> > SimpleDataFormat code?
>
>
> You have this 2 lines in your code
>
> feeds.add(pagefeed.getJSONObject(l).getString("created_time"));
> feeds.add(pagefeed.getJSONObject(l).getString("message"));
>
> changed it to something like this:
>
> SimpleDateFormat formatIn = new SimpleDateFormat("dd-MM-yyyy",
> Locale.ENGLISH);
> SimpleDateFormat formatOut = new SimpleDateFormat("yyyy-MM-dd",
> Locale.ENGLISH);
>
> String created_time =
> pagefeed.getJSONObject(l).getString("created_time");
> Date date = formatIn.parse(created_time);
>
> feeds.add(formatOut.format(date));
> feeds.add(pagefeed.getJSONObject(l).getString("message"));
>
--
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/android-developers/c41eb4b5-263b-4ae1-b117-5999c3fc2007%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.