Question

First of all in this web service there is no file or image upload or download, simply registration web service, while calling this API, i want to show progress update? How to do this? I am using this below code:

private class DetectLocation extends AsyncTask<String, String, String> {

        private JSONObject response, jPostObject;
        private String status, data;
        private ImageView iv1, iv2, iv3,ivAnim1, ivAnim2, ivAnim3;


        public DetectLocation(ImageView iv1, ImageView iv2, ImageView iv3,
                JSONObject obj,ImageView ivAnim1, ImageView ivAnim2, ImageView ivAnim3) {
            this.jPostObject = obj;
            this.iv1 = iv1;
            this.iv2 = iv2;
            this.iv3 = iv3;

            this.ivAnim1 = ivAnim1;
            this.ivAnim2 = ivAnim2;
            this.ivAnim3 = ivAnim3;
        }
        @Override
        protected void onProgressUpdate(String... values) {
            super.onProgressUpdate(values);

        }

        @Override
        protected void onPreExecute() {
            super.onPreExecute();

        }

        @Override
        protected String doInBackground(String... args) {
            try {

                List<NameValuePair> params = new ArrayList<NameValuePair>();
                params.add(new BasicNameValuePair("data", jPostObject
                        .toString()));
                response = WebAPIRequest.makeJsonObjHttpRequest(
                        URLS.DETECT_LOCATION, "POST", params);
                status = response.getString("status");
                UTILS.Log_e(TAG, response.toString());
                data = response.getString("data");
            } catch (Exception e) {
                UTILS.Log_e(TAG + "-Exception", "" + e);
            }

            return null;
        }

        @Override
        protected void onPostExecute(String args) {

        }
    }  
Was it helpful?

Solution

this in you progress update.

   @Override
    protected void onPreExecute() {
        pd.setMessage("Please wait...");
        pd.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
        pd.setCancelable(false);
        pd.show();

    }

            @Override
    protected void onProgressUpdate(Integer... progress) {

        pd.setProgress((int) (progress[0]));
    }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top