title: adding bitmap to GridView
body: <p>I tried to figured out why it doesn't work. Adapter with R.id.drawables (not included in code) works fine.
  Simply putting bitmap into ImageView works fine too. 
  I think problem is in my adapter but I don't know where.
  Any help will be appreciated. Thanks.</p>
  
  <pre><code>import android.app.Activity;
  import android.graphics.Bitmap;
  import android.os.Bundle;
  import android.util.Log;
  import android.view.View;
  import android.widget.BaseAdapter;
  import android.widget.Button;
  import android.widget.GridView;
  import android.widget.ImageView;
  import android.widget.ProgressBar;
  import android.widget.TextView;
  import android.widget.Toast;
  
  import com.google.gson.JsonObject;
  import com.koushikdutta.async.future.Future;
  import com.koushikdutta.async.future.FutureCallback;
  import com.koushikdutta.ion.Ion;
  import com.koushikdutta.ion.ProgressCallback;
  import com.squareup.picasso.Picasso;
  
  import java.io.File;
  import java.io.IOException;
  import java.util.ArrayList;
  import java.util.List;
  import java.util.concurrent.ExecutionException;
  
  public class MainActivity extends Activity {
      private Button chuckNorrisButton;
      private Button catButton;
      private ProgressBar progressBar;
      private TextView downloadCount;
      private TextView quoteTextView;
      GridView gridData;
      Future&lt;JsonObject&gt; downloading;
      public  List&lt;Bitmap&gt; bitmaps = new ArrayList&lt;&gt;();
      //public List&lt;Integer&gt; bitmapsInt = new ArrayList&lt;&gt;();
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          chuckNorrisButton = (Button)findViewById(R.id.donloadChuckNorrisButton);
          catButton = (Button)findViewById(R.id.downloadCatButton);
          progressBar = (ProgressBar)findViewById(R.id.progressBar3);
          downloadCount = (TextView)findViewById(R.id.downloadCount);
          quoteTextView = (TextView)findViewById(R.id.quoteTextView);
          gridData = (GridView)findViewById(R.id.gallery_grid);
          //gridData.setAdapter(new BitmapAdapter(getBaseContext(), bitmaps));
  
  
          catButton.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
  
                  Ion.with(MainActivity.this)
                          .load("http://25.media.tumblr.com/tumblr_lpqn543evY1qb1nczo1_500.jpg")//("http://thecatapi.com/api/images/get?format=src")
                          .progressBar(progressBar)
                          .progressHandler(new ProgressCallback() {
                              @Override
                              public void onProgress(long downloaded, long total) {
                                  downloadCount.setText("" + downloaded + " / " + total);
                              }
                          })
                          .asBitmap()
                          .setCallback(new FutureCallback&lt;Bitmap&gt;() {
                              @Override
                              public void onCompleted(Exception e, Bitmap result) {
                                  if (e != null) {
                                      Toast.makeText(MainActivity.this, "Error downloading file", Toast.LENGTH_LONG).show();
  
                                      return;
                                  }
                                   //IT WORKS
                                  //ImageView imageView = (ImageView)findViewById(R.id.imageView2);
                                  //imageView.setImageBitmap(result);
  
  
                                 bitmaps.add(result);
                              gridData.setAdapter(new BitmapAdapter(MainActivity.this, bitmaps));
                                  Toast.makeText(MainActivity.this, "File upload complete", Toast.LENGTH_LONG).show();
  
                              }
                          });
  
  
              }
  
          });
  
      }
  
  }
  </code></pre>
  
  <p>And my adapter</p>
  
  <pre><code>public class BitmapAdapter extends BaseAdapter {
  
      private Context mContext;
      List&lt;Bitmap&gt; gridViewitems;
  
      public BitmapAdapter(Context c, List&lt;Bitmap&gt; gridViewitems){
  
          mContext = c;
          this.gridViewitems=gridViewitems;
      }
  
      @Override
      public int getCount() {
          return 0;
      }
  
      @Override
      public Object getItem(int position) {
          return null;
      }
  
      @Override
      public long getItemId(int position) {
          return 0;
      }
  
      // create a new ImageView for each item referenced by the Adapter
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          ImageView imageView;
  
          if (convertView == null) {
              imageView = new ImageView(mContext);
              imageView.setLayoutParams(new GridView.LayoutParams(85, 85));
              imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
              imageView.setPadding(8, 8, 8, 8);
          }
          else
          {
              imageView = (ImageView) convertView;
          }
          imageView.setImageBitmap(gridViewitems.get(position));
          return imageView;
      }
  
  
  }
  </code></pre>
  
  <p>@Edit
  Maybe the problem is in my layout file.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/activity_main"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:paddingBottom="@dimen/activity_vertical_margin"
      android:paddingLeft="@dimen/activity_horizontal_margin"
      android:paddingRight="@dimen/activity_horizontal_margin"
      android:paddingTop="@dimen/activity_vertical_margin"
      tools:context="com.example.rafal.restapidownload.MainActivity"&gt;
  
      &lt;ScrollView
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:layout_below="@+id/quoteTextView"&gt;
  
          &lt;GridView
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:numColumns="auto_fit"
              android:stretchMode="columnWidth"
              android:gravity="center"
              android:id="@+id/gallery_grid" /&gt;
      &lt;/ScrollView&gt;
  
      &lt;Button
          android:text="Cat"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:id="@+id/downloadCatButton"
          android:layout_alignParentTop="true"
          android:layout_alignParentEnd="true" /&gt;
  
      &lt;Button
          android:text="Quote"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:id="@+id/donloadChuckNorrisButton"
          android:layout_alignParentTop="true"
          android:layout_alignParentStart="true" /&gt;
  
      &lt;TextView
          android:layout_height="wrap_content"
          android:layout_width="wrap_content"
          android:inputType="textMultiLine"
          android:maxLines="10"
  
          android:ems="10"
          android:id="@+id/quoteTextView"
          android:layout_below="@+id/donloadChuckNorrisButton"
          android:layout_alignParentStart="true"
          android:layout_alignParentEnd="true" /&gt;
  
      &lt;ProgressBar
          style="?android:attr/progressBarStyleHorizontal"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:id="@+id/progressBar3"
          android:layout_above="@+id/quoteTextView"
          android:layout_centerHorizontal="true" /&gt;
  
      &lt;TextView
          android:text=""
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:id="@+id/downloadCount"
          android:layout_alignParentTop="true"
          android:layout_alignEnd="@+id/progressBar3" /&gt;
  
      &lt;ImageView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          app:srcCompat="@android:drawable/btn_dialog"
          android:id="@+id/imageView2"
          android:layout_marginTop="109dp"
          android:layout_below="@+id/quoteTextView"
          android:layout_alignParentStart="true" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>