java - How to remove inflate exceptions ocurring due to out of memory error -


i facing many crashes in kids abcd application , because of inflate exceptions arising due out of memory error.

application taking space, when running in foreground, causing crash.

this problem arises when switching between different activities rapidly heap area gets filled fast , application begins give inflate exception , crash before space freed on activity destroy. (rapid switching between activities done check app performance).

the main cause large images or application taking more space in cache background storage.

large size images not problem verified images should of moderate size. thing had done code have finished each activity on each intent calling finish()method. here finish() method used activity release bitmaps current space (on closing activity).

super.oncreate(savedinstancestate);     setcontentview(r.layout.ringa_ringa);         pause = (imageview) findviewbyid(r.id.pause);     txt = (textview) findviewbyid(r.id.txt);     pause.setvisibility(view.visible);     txt.settextcolor(color.parsecolor("#ffffff"));     list = new arraylist<>();     mediastoragedir = new file(environment.getexternalstoragedirectory(), "kids_rhymes");      ringa_thread_running = false;        pause.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view v) {             if (counter == 0) {                 mediaplayer.stop();                 ringa_thread_running = false;                 position = 0;                 if (lyrics_ring.isalive()) {                     lyrics_ring.interrupt();                 }                 pause.setimageresource(r.drawable.play);                 counter = 1;             } else if (counter == 1) {                 pause.setimageresource(r.drawable.pause);                 counter = 0;                 onresume();             }         }     });      string[] words = getresources().getstring(r.string.ringa).split("\\$");     (string w : words) {         system.out.println("=======string====" + w);         list.add(w);      } 

tried find out accurate solution didn't suitable one.

put below code in manifest

 android:largeheap="true" 

like

 <application     android:allowbackup="true"     android:icon="@mipmap/ic_launcher"     android:label="@string/app_name"     android:largeheap="true"     android:supportsrtl="true"     android:theme="@style/apptheme"> 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -