Is there a way to save a bitmap from the debug console in Android Studio (Intellij)

In Android Studio, you can view bitmaps from the debug console by clicking next to a variable (view bitmap). I was wondering if there is a way to save them on the computer you are working on? The bitmap I'm trying to save

+15
intellij-idea android-studio
source share
1 answer

it is possible to evaluate the code when execution is stopped at the breakpoint ... which allows you to insert code there that can then export using the specified Bitmap descriptor (provided that the active application has already been granted write permission). to external storage).

this will be the code to insert and evaluate, where bitmap is the handle to export:

 try { FileOutputStream output = new FileOutputStream(new File(Environment.getExternalStorageDirectory().toString(), "test.jpg")); bitmap.compress(Bitmap.CompressFormat.JPEG, 100, output); output.flush(); output.close(); } catch (Exception e) { e.printStackTrace(); } 

and this is how it should look:

evaluate code

the exported image can then be downloaded using "Device File Explorer" from /mnt/sdcard .

0
source share

All Articles