ops, I forgot the resources:
Bitmap bitmap;
bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.image);
bitmap = Bitmap.createScaledBitmap(bitmap, bitmap.getWidth(),
bitmap.getHeight(), false); //if you want to make it scaleble
Note: If you are creating this bitmap from the class of your main activity,
you can get the resources only by calling the "getResources()" (without
context).
I think you may be getting this problem cause of the context.getResources().
If you need to create the bitmap outside the class of your main activity you
set a parameter for the method (or the constructor) of the class will create
the bitmap like this:
public Bitmap CreateBitmapFactory (Resources res, int bitmapResourceId )
{
return BitmapFactory.decodeResource(res, bitmapResourceId );
}
You should call it from your main Activity class for example:
Bitmap bmp = object.CreateBitmapFactory( gerResources(), R.drawable.image);
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en