title: android problem with progress dialog
body: <p>I have an application where I fetch data from http server &amp; set data to activity.
  for fetching data from server it takes time. so i want to give an progress dialog there.
  I did that but problem is that progressdialog is coming but its not rotating(only constant).
  Plz anybody tell me how it came like this!</p>
  
  <p>Below is my code,</p>
  
  <pre><code>private void setupViews()
      {
          imgRestro = (ImageView) findViewById(R.id.imageResturant);
          tvRestroName = (TextView) findViewById(R.id.tvRestroName);
          tvRestroAddr = (TextView) findViewById(R.id.tvRestroAddr);
          tvRestroArea = (TextView) findViewById(R.id.tvRestroArea);
          tvRestroCity = (TextView) findViewById(R.id.tvRestroCity);
          tvRestroPhone = (TextView) findViewById(R.id.tvRestroPhone);
          tvRestroRating = (TextView) findViewById(R.id.tvRestroRating);
          tvRestroCuisines = (TextView) findViewById(R.id.tvRestroCuisines);
          tvRestroAttr = (TextView) findViewById(R.id.tvRestroAttributes);
      }
  //to execute url
      private String executeHttpGet(String URL) throws Exception {
  
          URL url = null;
          StringBuffer strBuf = null;
          BufferedReader read = null;
          HttpURLConnection httprequest = null;
          try {
              url = new URL(URL);
              httprequest = (HttpURLConnection) url.openConnection();
              httprequest.setRequestMethod("GET");
              httprequest.setDoInput(true);
              httprequest.setDoOutput(true);
              httprequest.setConnectTimeout(5000); //time for before connect
              httprequest.setRequestProperty("Content-Type",
                      "text/plain; charset=utf-8");
              //httprequest.setReadTimeout(15000);  //time for after connect
  
              read = new BufferedReader(new InputStreamReader(
                      httprequest.getInputStream()));
  
              strBuf = new StringBuffer();
  
              String line = "";
  
              while ((line = read.readLine()) != null) {
                  strBuf.append(line).append("\n");
              }
  
          } catch (IOException ex) {
  
          } finally {
              try {
                  httprequest.disconnect();
                  read.close();
              } catch (Exception ex) {
  
              }
          }
          return strBuf.toString();
  
      }
      //to assign all the info from json to activity textview or imageview
      private void examineJSONFile() {
          try {
  
              String str = "";
              page = executeHttpGet(url);
              Log.i("hello", str.toString());
  
              JSONObject topobj = new JSONObject(page);
              JSONObject innerobj = topobj.getJSONObject("restarutant");
  
              tvRestroName.setText("Restaurant "+innerobj.getString("name"));
              String photoURL = innerobj.getString("photo");
              URI uri = new URI(photoURL);
              Bitmap bmp = loadBitmap(photoURL);
              System.out.println("str ;" + photoURL + "    uri " + uri);
  
              imgRestro.setImageBitmap(Bitmap.createScaledBitmap(bmp, 300, 300,true));
              tvRestroAddr.setText("Address: " + innerobj.getString("address"));
              tvRestroArea.setText("Area: " + innerobj.getString("area"));
              tvRestroCity.setText("City: " + innerobj.getString("city"));
              JSONArray location = innerobj.getJSONArray("location");
              String lat = location.get(0).toString();
              String lng = location.get(1).toString();
              latitude = Double.valueOf(lat.trim()).doubleValue();
              longitude = Double.valueOf(lng.trim()).doubleValue();
              System.out.println("Lat :" + latitude + " Long :" + longitude);
  
              JSONArray phone = innerobj.getJSONArray("phone");
              tvRestroPhone.setText("Phone: " + phone.get(0).toString() + " ,"
                      + phone.get(1).toString());
  
              tvRestroRating.setText("Rating: " + innerobj.getString("rating"));
  
              JSONArray cuisines = innerobj.getJSONArray("cuisines");
              tvRestroCuisines.setText("Cuisines: " + cuisines.get(0).toString()
                      + " ," + cuisines.get(1).toString());
  
              JSONArray attributes = innerobj.getJSONArray("attributes");
              tvRestroAttr.setText("Attributes: " + attributes.get(0).toString()
                      + " ," + attributes.get(1).toString() + " ,"
                      + attributes.get(2).toString());
  
              Log.i("hello", str.toString());
  
          } catch (Exception je) {
              tvRestroAddr.setText("Error w/file: " + je.getMessage());
          }
      }
  
      // to get image from url in form of bitmap
      private static Bitmap loadBitmap(String url) {
          URL myFileUrl = null;
          InputStream is = null;
          try {
              myFileUrl = new URL(url);
          } catch (MalformedURLException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
          try {
              HttpURLConnection conn = (HttpURLConnection) myFileUrl
                      .openConnection();
              conn.setDoInput(true);
              conn.connect();
              is = conn.getInputStream();
              Log.i("im connected", "Download");
  
          } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
          return BitmapFactory.decodeStream(is);
      }
  
      //for progressdialog
       private class DownloadTask extends AsyncTask&lt;Void, Void, Void&gt; {
              private ProgressDialog dialog = new ProgressDialog(InfoActivity.this);
  
              protected void onPreExecute() {
                  System.out.println("In onPreExecute "); 
                  dialog.setTitle("Loading..");
                  dialog.setMessage("Downloading source..");
                  dialog.setProgress(100);
                  dialog.setMax(5000);
                  dialog.show();
              }
  
              protected Void doInBackground(Void... unused) {
                  //examineJSONFile();
                  System.out.println("In doInBackground ");   
                  return null;
              }
  
  
              protected void onPostExecute(Void unused) {
                  System.out.println("In onPostExecute ");    
                       dialog.dismiss();
                           examineJSONFile();         
  }
  </code></pre>
  
  <p>Plz have a look and give the answer.
  Thank you</p>