title: Android : Progress bar not shown even after setting visible.
body: <p>I am working on an Android project in which when user is uploading a image, I would like to display a progress-bar. But, even after setting that <code>show</code> the progress-bar, it's not working. What am I doing wrong?</p>
  
  <p>Code :</p>
  
  <pre><code> private ProgressBar spinner;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.add_restaurant_images);
  
          spinner=(ProgressBar)findViewById(R.id.progressBar);
          spinner.setVisibility(View.GONE);
      // Rest of the non-relevant to problem code
  }
  
        private void uploadImage(boolean profilePhoto) {
              spinner.setVisibility(View.VISIBLE);
              if (!(reducedSizeBitmap == null)) {
                  reducedSizeBitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
                  byte[] byteArray = stream.toByteArray();
                  this.restaurantService.addRestaurantImage(byteArray, profilePhoto);
              }
              spinner.setVisibility(View.GONE);
  
          }
  </code></pre>
  
  <p>XML file : </p>
  
  <pre><code>&lt;android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:id="@+id/restaurant_drawer_layout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
  
      &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:gravity="top|center"
          android:orientation="vertical"&gt;
  
  
          &lt;ImageView
              android:id="@+id/userPhotoImageView"
              android:layout_width="match_parent"
              android:layout_height="436dp"
              /&gt;
  
          &lt;LinearLayout
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"&gt;
  
              &lt;internetlegion.com.restaurantlunchify.Templates.MaterialRippleLayout
                  style="@style/RippleStyle"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_gravity="end"
                  android:layout_marginTop="54dp"
                  android:layout_marginRight="20dp"
                  android:layout_marginEnd="20dp"
                  app:rippleColor="@color/main_color_grey_400"&gt;
  
                  &lt;internetlegion.com.restaurantlunchify.Templates.RobotoTextView
                      android:id="@+id/uploadUserImageButton"
                      style="@style/ButtonStyle.RaisedEmpty"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:background="@color/main_color_900"
                      android:minWidth="112dp"
                      android:layout_marginRight="20dp"
                      android:layout_marginEnd="20dp"
                      android:text="Upload"
                      android:textColor="#fff" /&gt;
              &lt;/internetlegion.com.restaurantlunchify.Templates.MaterialRippleLayout&gt;
  
              &lt;CheckBox
                  android:layout_width="80dp"
                  android:layout_height="wrap_content"
                  android:layout_marginTop="0dp"
                  android:layout_marginRight="0dp"
                  android:layout_marginEnd="0dp"
                  android:layout_gravity="center_horizontal"
                  android:text="Default"
                  android:id="@+id/profilePhotoCheckBox"
                  android:checked="false" /&gt;
  
              &lt;internetlegion.com.restaurantlunchify.Templates.MaterialRippleLayout
                  style="@style/RippleStyle"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_gravity="end"
                  android:layout_marginTop="54dp"
                  app:rippleColor="@color/main_color_grey_400"&gt;
  
  
              &lt;internetlegion.com.restaurantlunchify.Templates.RobotoTextView
                  android:id="@+id/userPhotoButtonSelect"
                  style="@style/ButtonStyle.RaisedEmpty"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:background="@color/main_color_900"
                  android:minWidth="112dp"
                  android:text="Capture"
                  android:textColor="#fff" /&gt;
              &lt;/internetlegion.com.restaurantlunchify.Templates.MaterialRippleLayout&gt;
  
  
          &lt;/LinearLayout&gt;
  
  
  
      &lt;/LinearLayout&gt;
  
      &lt;ProgressBar
          style="?android:attr/progressBarStyleLarge"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:id="@+id/progressBar"
          android:progressDrawable="@drawable/circular_progress_bar"
          android:layout_below="@+id/button"
          android:layout_alignRight="@+id/textView"
          android:layout_alignEnd="@+id/textView"
          android:layout_alignLeft="@+id/textview"
          android:layout_alignStart="@+id/textview"
          android:layout_alignParentBottom="true" /&gt;
  
  
      &lt;ListView
          android:id="@+id/restaurant_list_slidermenu"
          android:layout_width="240dp"
          android:layout_height="match_parent"
          android:layout_gravity="start"
          android:choiceMode="singleChoice"
          android:dividerHeight="1dp" /&gt;
  
  &lt;/android.support.v4.widget.DrawerLayout&gt;
  </code></pre>
  
  <p>The image is purposefully around 6mb which I am uploading to see the bar, but it is not to be seen. Any help would be nice. Thanks a lot. :-)</p>