Writing the chapter 6
[PFCLatex/.git] / source / JavaHTTPJSONtreatment.java
diff --git a/source/JavaHTTPJSONtreatment.java b/source/JavaHTTPJSONtreatment.java
new file mode 100644 (file)
index 0000000..c448934
--- /dev/null
@@ -0,0 +1,18 @@
+JSONTokener tokener = new JSONTokener(builder.toString());
+JSONArray finalResult = new JSONArray(tokener);
+Uri uriInsert = null;
+
+for (int i = 0; i < (finalResult.length() -1); i++) {
+    JSONObject objects = finalResult.getJSONObject(i);
+    if ((uriInsert = updatedIndexer(objects)) != null) {
+        try {
+            downloadAds((String)objects.get("image"), (String) objects.get("id"));
+            Intent updateList = new Intent("de.android.mobiads.MOBIADSLISTRECEIVER");
+            context.sendBroadcast(updateList);
+            updateNotification();
+        } catch (Throwable e1) {
+            context.getContentResolver().delete(uriInsert, null, null);
+            context.deleteFile((String) objects.get("id"));
+        }
+    }
+}