Example #1
0
 @SuppressLint("SimpleDateFormat")
 public void getCommunityInformation() {
   JSONArray jArr = null;
   JSONArray jArr2 = null;
   String jsonuser = null;
   String fql =
       "SELECT updated_time, message, attachment FROM stream WHERE source_id =228398190627075";
   Bundle parameters = new Bundle();
   parameters.putString("format", "json");
   parameters.putString("query", fql);
   parameters.putString("method", "fql.query");
   parameters.putString("access_token", getAccessToken());
   JSONObject JOmessage = null;
   JSONObject JOmessage2 = null;
   try {
     jsonuser = "******"data\":" + facebook.request(parameters) + "}";
     JSONObject JObj = new JSONObject(jsonuser);
     jArr = JObj.getJSONArray("data");
     strPic = new String[jArr.length()];
     strCmd = new String[jArr.length()];
     strDte = new String[jArr.length()];
     for (int inI = 0; inI < jArr.length(); inI++) {
       System.out.println("" + inI);
       JOmessage = jArr.getJSONObject(inI);
       strMessage = JOmessage.getString("message");
       strDate = JOmessage.getString("updated_time");
       long lngTimeStamp = Long.valueOf(strDate);
       Date dteGetDate = new Date(lngTimeStamp * 1000L);
       SimpleDateFormat sdfTimeFormatter = new SimpleDateFormat("dd-MM-yyyy  hh:mm aa");
       String strGetTime = sdfTimeFormatter.format(dteGetDate);
       Log.i(SharePicMain.TAG, "UpdateCheckService : DATE=" + strGetTime);
       JSONObject JOattachment = JOmessage.getJSONObject("attachment");
       if (JOattachment.getJSONArray("media") != null) {
         jArr2 = JOattachment.getJSONArray("media");
         JOmessage2 = jArr2.getJSONObject(0);
         strSrc = JOmessage2.getString("src");
       }
       strCmd[inI] = ("\t" + strMessage);
       strDte[inI] = ("\n\tDate :" + strGetTime + "\n");
       strPic[inI] = strSrc;
       strMArListImageurls.add(strPic[inI]);
       strMArlistComments.add(strCmd[inI]);
       strMArlistDate.add(strDte[inI]);
       strMarListCommentsdate.add(strCmd[inI] + "" + strDte[inI]);
     }
   } catch (MalformedURLException e) {
     e.printStackTrace();
   } catch (IOException e) {
     e.printStackTrace();
   } catch (JSONException e) {
     e.printStackTrace();
   }
 }