I create a custom dialog with imageview.
When it close and open oftentimes this error occur
java.lang.OutOfMemoryError: Failed to allocate a 35236108 byte allocation with 16775584 free bytes and 16MB until OOM
dialog code:
msg.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            final Dialog dialog = new Dialog(Settings.maincontext);
            dialog.setContentView(R.layout.perfil);
            dialog.show();
            Vibrator vibration = (Vibrator) Settings.maincontext.getSystemService(Context.VIBRATOR_SERVICE);
            vibration.vibrate(100);
            dialog.setCanceledOnTouchOutside(true);
            return false;
        }
    });
I believe that at the end of the dialog i need to clear the memory so there is space to the next dialog.
 
     
     
    