Setting the List<Bitmap> to a GridView in Android
<p>I am developing an app where I have a list of bitmaps and I want to place those bitmaps in a gridView. I have the folleowing code.</p>

<p>My Activity for gridView</p>

<pre><code>public class TestBitmap extends Activity {

private Bitmap bitmap;
private ImageView image;
public static List&lt;Bitmap&gt; splittedBitmaps;

@Override
public void onCreate(Bundle bundle){
    super.onCreate(bundle);
    setContentView(R.layout.splitted_grid);
    splittedBitmaps = getIntent().getParcelableArrayListExtra("split");
    GridView gv = (GridView)findViewById(R.layout.splitted_grid);
    gv.setAdapter(new SplittedImageAdapter(this));
}
}
</code></pre>

<p>and this is my Adapter class</p>

<pre><code>public class SplittedImageAdapter extends BaseAdapter{

private Context mContext;

public SplittedImageAdapter(Context c){
    mContext = c;
}

@Override
public int getCount() {
    return TestBitmap.splittedBitmaps.size();
}

@Override
public Object getItem(int arg0) {
    return null;
}

@Override
public long getItemId(int arg0) {
    return 0;
}

@Override
public View getView(int arg0, View arg1, ViewGroup arg2) {
    ImageView imageView = new ImageView(mContext);
    imageView.setLayoutParams(new GridView.LayoutParams(30,30));
    imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
    imageView.setPadding(1, 1, 1, 1);
    //imageView.setImageResource(TestBitmap.splittedImages.get(arg0));
    imageView.setImageBitmap(TestBitmap.splittedBitmaps.get(arg0));
    return imageView;
}
</code></pre>

<p>}</p>

<p>I am getting a NullPointerException in the last line of the onCreate method of my Activity class.
Please help me to trace the bug.</p>
