Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It looks like there should only be one bitmap in memory at a time. A few thoughts.</p> <p>First when recycling the bitmap set it to null, also set the canvas to null. If this does not solve the issue, i would be curious to see the code you are using to actually paint the lines. Also getting a heap dump after invoking the dialog and closing it will show you which objects are still in memory, and allow you to quickly track down what is holding on to the bitmap, and it's kinda fun :)</p> <p>This <a href="http://android-developers.blogspot.com/2011/03/memory-analysis-for-android.html" rel="nofollow">post</a> is a great start on investigating a heap dump if you have not done it before.</p> <p>UPDATE</p> <p>To set the canvas to null, you can do something like this</p> <pre><code>public void recycling() { bitmap.recycle(); bitmap = null; bitmapCanvas = null; } </code></pre> <p>However upon closer inspection of your code, i see that you are creating a new dialog everytime and then dismissing the dialog. This will not free up the dialog from memory. Try updating your code so you only initialize the dialog if it is null.</p> <pre><code>public void write_board () { if(writing_dialog == null){ writing_dialog = new Dialog(Apple.this, android.R.style.Theme_Translucent_NoTitleBar); WindowManager.LayoutParams lp = writing_dialog.getWindow().getAttributes(); lp.dimAmount = 0.5f; writing_dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); Window window = writing_dialog.getWindow(); window.setGravity(Gravity.CENTER); writing_dialog.setContentView(R.layout.alert_drawing_pad); writing_dialog.setCancelable(true); writing_dialog.setVolumeControlStream(AudioManager.STREAM_MUSIC); } //now do stuff with your dialog writing_dialog.show(); doodleView = (DoodleView) writing_dialog.findViewById(R.id.doodleView); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload