Page 103 - 3-2
P. 103

/**
                 * 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(MainActivity_owner_compare_yet.this);
                        pDialog.setMessage("Loading products. Please wait...");
                        pDialog.setIndeterminate(false);
                        pDialog.setCancelable(false);
                        pDialog.show();


                        Log.d(" 여긴가", "owner_5-5,  다이얼로그");
                    }


                    /**
                     * getting All products from url
                     */
                    protected String doInBackground(String... args) {
                        // Building Parameters
                        List<NameValuePair> params = new ArrayList<NameValuePair>();
                        // getting JSON string from URL
                        JSONObject json = jParser.makeHttpRequest(url_all_products, "GET", params);


                        // Check your log cat for JSON reponse
                        Log.d("All Products: ", json.toString());
                        Log.d(" 여긴가", "owner_5-6,  출력하러 옴");
                        Log.d(" 여긴가",json.toString());


                        try {
                            // Checking for SUCCESS TAG
                            int success = json.getInt(TAG_SUCCESS);
                            Log.d(" 여긴가", "owner_5-7,try  들어옴");


                            if (success == 1) {
                                Log.d(" 여긴가","owner_5-8,success   는 1");
                                // products found
                                // Getting Array of Products
                                products = json.getJSONArray(TAG_PRODUCTS);


                                                         - 103 -
   98   99   100   101   102   103   104   105   106   107   108