Okay, so I have a code, that take an image of the current view, and turns it into a bitmap, then I end up here,
Bitmap bm = view.getDrawingCache();
BitmapDrawable bitmapDrawable = new BitmapDrawable(bm);
now, what I'm trying to do, is take a picture of what the current view looks like, but from here, I can easily put bitmapDrawable
into an ImageView, but thats not what I want, I'd like to go from here, to saving it. What can I do? I found out one way, using
FileOutputStream fos;
try {
fos = super.openFileOutput("output.png",MODE_WORLD_READABLE);
bm.compress(CompressFormat.PNG, 75, fos);
fos.flush();
fos.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
but when I do this, I end up with a NullPointerException at
bm.compress(CompressFormat.PNG, 75, fos);
am I missing something?
Okay, now it makes it through the above code, then makes it past fos.close();
to finish, but then nothing happens, its not saved, not on my phone, nothing