Re: [android-developers] How to change Format of the Facebook SDK "Created_Time"

2016-02-23 Thread Mark van Limburg
Follow up.
I changed "JSONException" and "ParseException" to "Exception" only and 
suddenly everything works.
I am super stoked! Thank you so much for helping out.

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-", 
> Locale.ENGLISH); 
>  SimpleDateFormat formatOut = new SimpleDateFormat("-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 android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
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/89941b50-9c02-457d-90df-1926fcee1737%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [android-developers] How to change Format of the Facebook SDK "Created_Time"

2016-02-23 Thread Mark van Limburg
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-", 
> Locale.ENGLISH); 
>  SimpleDateFormat formatOut = new SimpleDateFormat("-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 android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
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.


Re: [android-developers] How to change Format of the Facebook SDK "Created_Time"

2016-02-23 Thread Ralph Bergmann | the4thFloor.eu

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-", 
Locale.ENGLISH);
SimpleDateFormat formatOut = new SimpleDateFormat("-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 android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
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/56CC96D8.7040107%40the4thfloor.eu.
For more options, visit https://groups.google.com/d/optout.


Re: [android-developers] How to change Format of the Facebook SDK "Created_Time"

2016-02-23 Thread Mark van Limburg
Thank you for the links.
I am aware of it that i need to use SimpleDateFormat.
But i am struggling with where to put the code.
Everytime i seem to want to add something, i get error here and error there 
and i cannot figure out, what do i have to do to make the SimpleDataFormat 
work properly.

According to the earlier pasted Class file, where would you paste the 
SimpleDataFormat code?

On Tuesday, February 23, 2016 at 4:18:44 PM UTC+1, Ralph Bergmann wrote:
>
> Am 23.02.16 um 15:22 schrieb Mark van Limburg: 
> > Can someone help me where i should post the code and what kind of code 
> > for using simple date format? 
>
>
> You can use Androids SimpleDateFormat to parse the date 
>
> http://developer.android.com/reference/java/text/SimpleDateFormat.html 
>
> If you need more try https://github.com/JakeWharton/ThreeTenABP 
>

-- 
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 android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
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/f6e098b6-6c95-4582-a359-824d7513fc08%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [android-developers] How to change Format of the Facebook SDK "Created_Time"

2016-02-23 Thread Ralph Bergmann | the4thFloor.eu

Am 23.02.16 um 15:22 schrieb Mark van Limburg:

Can someone help me where i should post the code and what kind of code
for using simple date format?



You can use Androids SimpleDateFormat to parse the date

http://developer.android.com/reference/java/text/SimpleDateFormat.html

If you need more try https://github.com/JakeWharton/ThreeTenABP

--
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 android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
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/56CC75D1.1060007%40the4thfloor.eu.
For more options, visit https://groups.google.com/d/optout.