I have this code
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mImageView = (ImageView) findViewById(R.id.image);
Bitmap mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.icon);
mImageView.setImageBitmap(mBitmap);
}
It works fine in Android Emulator Level 6 but not work in Emulator level 5, not depend on level of library was added in my project.
In Emulator level 5, BitmapFactory.decodeResource return null.
How to fix it. Plz help me.
Try this,
Create a
drawablefolder insideresfolder and keep youricon.pngimage.And then you can try the above code.