| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 
 |  
        // Building Parameters
        List<NameValuePair> params = new ArrayList<NameValuePair>();
 
 
 
        // getting JSON string from URL
        JSONObject json = jParser.makeHttpRequest(url_all_picture, "GET", params);
 
        if (json==null) {
            Toast.makeText(this,
            "json==null",
            Toast.LENGTH_SHORT).show();
            return;
        }
 
        // Check your log cat for JSON reponse
          Log.d("All Products: ", json.toString());
 
 
 
        try {
            // Checking for SUCCESS TAG
            int success = json.getInt(TAG_SUCCESS);
 
            if (success == 1) {
                // products found
                // Getting Array of Products
            	pictures = json.getJSONArray(TAG_PICTURES);
 
                // looping through All Products
                for (int i = 0; i < pictures.length(); i++) {
                    JSONObject c = pictures.getJSONObject(i);
 
                    // Storing each json item in variable
                    String id = c.getString(TAG_PICTURE);
                    String name = c.getString(TAG_COMMENT);
                    String date = c.getString(TAG_DATE);
 
                    // creating new HashMap
                    HashMap<String, String> map = new HashMap<String, String>();
 
                    // adding each child node to HashMap key => value
                    map.put(TAG_PICTURE, id);
                    map.put(TAG_COMMENT, name);
                    map.put(TAG_DATE, date);
 
                    // adding HashList to ArrayList
                    pictureList.add(map);
                }
            } else {
 
 
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
 
 
        items.add(new SeparatorItem(TAG_DATE));
        items.add(new ThumbnailItem("Powered paragliding", "aka paramotoring", R.drawable.gd_action_bar_help));
        items.add(new DescriptionItem(TAG_COMMENT));
 
        items.add(new SeparatorItem("Class 2"));
        items.add(new DrawableItem("Trikes", R.drawable.gd_action_bar_help));
        items.add(new DescriptionItem("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tempus consequat leo, et tincidunt justo tristique in."));
 
        items.add(new SeparatorItem("Class 3"));
        items.add(new ThumbnailItem("Multi-axis", "Looks like a tiny plane", R.drawable.gd_action_bar_help));
        items.add(new DescriptionItem("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tempus consequat leo, et tincidunt justo tristique in."));
 
        items.add(new SeparatorItem("Class 4"));
        items.add(new ThumbnailItem("Auto-gyro", "A scary helicopter", R.drawable.gd_action_bar_help));
        items.add(new DescriptionItem("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tempus consequat leo, et tincidunt justo tristique in."));
 
        items.add(new SeparatorItem("Class 5"));
        items.add(new DrawableItem("Hot air baloon", R.drawable.gd_action_bar_help));
        items.add(new DescriptionItem("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tempus consequat leo, et tincidunt justo tristique in."));
 
        final Item item1 = new SeparatorItem("Class 6");
        final Item item2 = new TextItem("Airbus/Boeing planes");
        final Item item3 = new DescriptionItem("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tempus consequat leo, et tincidunt justo tristique in.");
        items.add(item1);
        items.add(item2);
        items.add(item3);
 
        final ProgressItem progressItem = new ProgressItem("Next !", true);
        items.add(progressItem);
 
        final ItemAdapter adapter = new ItemAdapter(this, items);
        setListAdapter(adapter);
 
        mHandler.postDelayed(new Runnable() {
            public void run() {
 
                adapter.notifyDataSetChanged();
            }
        },8000);
    }
 
 
 
    /**
     * Background Async Task to Load all product by making HTTP Request
     * */
    class LoadAllProducts extends AsyncTask<String, String, String> {
 
        /**
         * Before starting background thread Show Progress Dialog
         * */
        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            pDialog = new ProgressDialog(FollowActivity.this);
            pDialog.setMessage("Loading... Please wait...");
            pDialog.setIndeterminate(false);
            pDialog.setCancelable(false);
            pDialog.show();
        }
 
        /**
         * getting All products from url
         * */
        protected String doInBackground(String... args) {
 
 
            return null;
        }
 
        /**
         * After completing background task Dismiss the progress dialog
         * **/
        protected void onPostExecute(String file_url) {
            // dismiss the dialog after getting all products
            pDialog.dismiss();
            // updating UI from Background Thread
            runOnUiThread(new Runnable() {
                public void run() {
                    /**
                     * Updating parsed JSON data 
                     * */
 
 
 
 
                }
            });
 
        }
 
    }
 
} | 
Partager