I have the following case:
Activity1
public class Activity1 extends Activity{
ImageUtils.setArt(bitmap);
}
Activity2
public class Activity2 extends Activity{
Bitmap b= ImageUtils.getArt();
}
ImageUtils
public class ImageUtils{
private static Bitmap mArtWork;
public static Bitmap getArt(){
return mArtWork;
}
public static void setArt(Bitmap art){
this.mArtWokr=art;
}
Now, I need a good approach, to share Bitmap
s among different Activity
s.
Since static
variables will not be Garbage Collected during my application execution, I need a good way to share the images amongst my scenarios.
I am considering using a singleton "ImageUtils" to hold my images, and then access then.
I have considered and disregarded passing pareaceable bitmaps, and even sharing URI through intents, but those have had bad results.
Are there better approaches?