Search code examples
androidbitmapgetresource

Load Bitmap on BaseAdapter


Hi I want to load resource drawable in bitmap type at baseadapter but get some error

Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.messenger);

the getResource() need to make function on the java file.

how to get it?


Solution

  • Pass your activity instance to the Base adapter first , then change you function to

    Bitmap bm = BitmapFactory.decodeResource(activity.getResources(), R.drawable.messenger);