How should I save an image on Android? -


i wondering efficient way of saving image on android is.

what app this: see default credit card, next can choose scan barcode (with zxing), generate qr-code it, , place qr-code in imageview default card stored.

so far good; however, there's issue app remembering image show when navigating away result (another screen in app, going homescreen of device, etc) , going screen. shows default card again.

now, understand have save qr-code can't come solution. device has no sd-card saving external storage not option.

i've tried solving via sharedpreferences, outputstream, , cache; couldn't work.

which of 3 ways (or maybe different one, welcome) choose , code that?

public boolean savebitmap(bitmap image, string name){     try {         fileoutputstream fos = context.openfileoutput(name, context.mode_private);         image.compress(bitmap.compressformat.jpeg, 70, fos);         fos.close();         return true;     }     catch (exception e) {         e.printstacktrace();         return false;     } }  public bitmap getbitmap(string name){     try {         fileinputstream fis = context.openfileinput(name);         bitmap image = bitmapfactory.decodestream(fis);         return image;     }     catch (exception e) {         e.printstacktrace();         return null;     } } 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

node.js - Bad Request - node js ajax post -

uitableview - Create and use custom prototype table cells in xamarin ios using storyboard -