diff --git a/FoodCloud.apk b/FoodCloud.apk deleted file mode 100755 index 10c73ea..0000000 Binary files a/FoodCloud.apk and /dev/null differ diff --git a/FoodCloud/app/src/main/java/gq/yigit/foodcloud/PHPComm.java b/FoodCloud/app/src/main/java/gq/yigit/foodcloud/PHPComm.java index c676eec..1abd3a8 100644 --- a/FoodCloud/app/src/main/java/gq/yigit/foodcloud/PHPComm.java +++ b/FoodCloud/app/src/main/java/gq/yigit/foodcloud/PHPComm.java @@ -78,8 +78,9 @@ public class PHPComm extends AsyncTask { protected void onPostExecute(String result) { alertDialog.setMessage(result); Log.d(TAG, "AlertBoxSet " + result); - json_return = result; alertDialog.show(); + ProductInfo flow = new ProductInfo(); + flow.continueApp(result); } @Override diff --git a/FoodCloud/app/src/main/java/gq/yigit/foodcloud/ProductInfo.java b/FoodCloud/app/src/main/java/gq/yigit/foodcloud/ProductInfo.java index 61ec9dc..26e2598 100644 --- a/FoodCloud/app/src/main/java/gq/yigit/foodcloud/ProductInfo.java +++ b/FoodCloud/app/src/main/java/gq/yigit/foodcloud/ProductInfo.java @@ -90,18 +90,18 @@ public class ProductInfo extends AppCompatActivity implements OnClickListener { // whenever data at this location is updated. PHPComm comm = new PHPComm(this); comm.execute("get", "1", "Products"); - try { - json_str = comm.json_return; - while(json_str == null){ - json_str = comm.json_return; - continue; - } + } + + public void continueApp(String json_str){ + try { Log.d(TAG,"This is a pointer"); - //Log.d(TAG,"get json str" + json_str); - //JSONObject jsonObj = new JSONObject(json_str); - }catch (NullPointerException e) { + Log.d(TAG,"get json str" + json_str); + JSONObject jsonObj = new JSONObject(json_str); + }catch (JSONException e) { Log.d(TAG, "An error occured with the json!"); + }catch (NullPointerException e){ + Log.d(TAG,"Received null data!"); } /* Name = (TextView) findViewById(R.id.name); @@ -151,7 +151,5 @@ public class ProductInfo extends AppCompatActivity implements OnClickListener { - - } diff --git a/database/communication/.idea/workspace.xml b/database/communication/.idea/workspace.xml index 6c42239..dcb7846 100644 --- a/database/communication/.idea/workspace.xml +++ b/database/communication/.idea/workspace.xml @@ -129,7 +129,6 @@ - diff --git a/database/content/Products/1.json b/database/content/Products/1.json index a7e8f77..4bf50f8 100644 --- a/database/content/Products/1.json +++ b/database/content/Products/1.json @@ -1 +1 @@ -"{\"Allergens\": [\"Lactose\"], \"Cooked\": false, \"Problematic\": false, \"Process\": \"Pastorized\", \"Nutrients\": [\"Protein\", \"Fat\", \"Lactose\", \"Glucose\"], \"BBD\": \"24.08.2018\", \"Calories\": 120, \"Prod_Name\": \"Milk\"}" +{"Allergens": ["Lactose"], "Cooked": false, "Problematic": false, "Process": "Pastorized", "Nutrients": ["Protein", "Fat", "Lactose", "Glucose"], "BBD": "24.08.2018", "Calories": 120, "Prod_Name": "Milk"} \ No newline at end of file