Writing the chapter 6
[PFCLatex/.git] / source / JavaHTTPJSONtreatment.java
1 JSONTokener tokener = new JSONTokener(builder.toString());
2 JSONArray finalResult = new JSONArray(tokener);
3 Uri uriInsert = null;
4
5 for (int i = 0; i < (finalResult.length() -1); i++) {
6     JSONObject objects = finalResult.getJSONObject(i);
7     if ((uriInsert = updatedIndexer(objects)) != null) {
8         try {
9             downloadAds((String)objects.get("image"), (String) objects.get("id"));
10             Intent updateList = new Intent("de.android.mobiads.MOBIADSLISTRECEIVER");
11             context.sendBroadcast(updateList);
12             updateNotification();
13         } catch (Throwable e1) {
14             context.getContentResolver().delete(uriInsert, null, null);
15             context.deleteFile((String) objects.get("id"));
16         }
17     }
18 }