ANDROID: starting activity with button click; the button has a background; excess memory issue -


i think have been able resolve main problem - folks help however, getting following warning / error messages in logcat:

06-03 10:52:25.420 7149-7149/xxx e/dalvikvm: not find class 'android.util.arraymap', referenced method com.android.tools.fd.runtime.monkeypatcher.monkeypatchexistingresources  06-03 10:52:25.420 7149-7149/xxx w/dalvikvm: vfy: unable resolve check-cast 1832 (landroid/util/arraymap;) in lcom/android/tools/fd/runtime/monkeypatcher;  06-03 10:52:25.420 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x1f @ 0x0258  06-03 10:52:25.420 7149-7149/xxx e/dalvikvm: not find class 'android.util.arraymap', referenced method com.android.tools.fd.runtime.monkeypatcher.pruneresourcecache  06-03 10:52:25.420 7149-7149/xxx w/dalvikvm: vfy: unable resolve const-class 1832 (landroid/util/arraymap;) in lcom/android/tools/fd/runtime/monkeypatcher;  06-03 10:52:25.420 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x1c @ 0x0058  06-03 10:52:25.435 7149-7149/xxx i/dalvikvm: not find method android.content.context.getsystemservice, referenced method xxx.mainactivity.access$super  06-03 10:52:25.435 7149-7149/xxx w/dalvikvm: vfy: unable resolve virtual method 512: landroid/content/context;.getsystemservice (ljava/lang/class;)ljava/lang/object;  06-03 10:52:25.435 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x6f @ 0x004b  06-03 10:52:25.435 7149-7149/xxx i/dalvikvm: not find method android.app.activity.stoplocktask, referenced method xxx.mainactivity.access$super  06-03 10:52:25.435 7149-7149/xxx w/dalvikvm: vfy: unable resolve virtual method 248: landroid/app/activity;.stoplocktask ()v  06-03 10:52:25.435 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x6f @ 0x00b9  06-03 10:52:25.435 7149-7149/xxx e/dalvikvm: not find class 'android.os.persistablebundle', referenced method xxx.mainactivity.access$super  06-03 10:52:25.435 7149-7149/xxx w/dalvikvm: vfy: unable resolve check-cast 260 (landroid/os/persistablebundle;) in lyyy/mainactivity;  06-03 10:52:25.435 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x1f @ 0x00f1  06-03 10:52:25.435 7149-7149/xxx i/dalvikvm: not find method android.content.context.getcolorstatelist, referenced method xxx.mainactivity.access$super  06-03 10:52:25.435 7149-7149/xxx w/dalvikvm: vfy: unable resolve virtual method 492: landroid/content/context;.getcolorstatelist (i)landroid/content/res/colorstatelist;  06-03 10:52:25.435 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x6f @ 0x0101  06-03 10:52:25.435 7149-7149/xxx i/dalvikvm: not find method android.app.activity.onvisiblebehindcanceled, referenced method xxx.mainactivity.access$super  06-03 10:52:25.435 7149-7149/xxx w/dalvikvm: vfy: unable resolve virtual method 168: landroid/app/activity;.onvisiblebehindcanceled ()v  06-03 10:52:25.435 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x6f @ 0x0111  06-03 10:52:25.435 7149-7149/xxx i/dalvikvm: not find method android.app.activity.onwindowstartingactionmode, referenced method xxx.mainactivity.access$super  06-03 10:52:25.435 7149-7149/xxx w/dalvikvm: vfy: unable resolve virtual method 172: landroid/app/activity;.onwindowstartingactionmode (landroid/view/actionmode$callback;i)landroid/view/actionmode;  06-03 10:52:25.435 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x6f @ 0x0137  06-03 10:52:25.435 7149-7149/xxx e/dalvikvm: not find class 'android.os.persistablebundle', referenced method xxx.mainactivity.access$super  06-03 10:52:25.435 7149-7149/xxx w/dalvikvm: vfy: unable resolve check-cast 260 (landroid/os/persistablebundle;) in lyyy/mainactivity;  06-03 10:52:25.435 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x1f @ 0x019a  06-03 10:52:25.435 7149-7149/xxx e/dalvikvm: not find class 'android.media.session.mediacontroller', referenced method xxx.mainactivity.access$super  06-03 10:52:25.435 7149-7149/xxx w/dalvikvm: vfy: unable resolve check-cast 213 (landroid/media/session/mediacontroller;) in lyyy/mainactivity;  06-03 10:52:25.435 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x1f @ 0x01b2  06-03 10:52:25.435 7149-7149/xxx e/dalvikvm: not find class 'android.widget.toolbar', referenced method xxx.mainactivity.access$super  06-03 10:52:25.435 7149-7149/xxx w/dalvikvm: vfy: unable resolve check-cast 2020 (landroid/widget/toolbar;) in lyyy/mainactivity;  06-03 10:52:25.435 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x1f @ 0x01bc  06-03 10:52:25.435 2365-2490/? i/crashanrdetector: onpackageupdatefinished : xxx  06-03 10:52:25.435 7149-7149/xxx i/dalvikvm: not find method android.app.activity.releaseinstance, referenced method xxx.mainactivity.access$super  06-03 10:52:25.435 7149-7149/xxx w/dalvikvm: vfy: unable resolve virtual method 179: landroid/app/activity;.releaseinstance ()z  06-03 10:52:25.435 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x6f @ 0x02dd  06-03 10:52:25.435 7149-7149/xxx i/dalvikvm: not find method android.app.activity.onactivityreenter, referenced method xxx.mainactivity.access$super  06-03 10:52:25.435 7149-7149/xxx w/dalvikvm: vfy: unable resolve virtual method 112: landroid/app/activity;.onactivityreenter (ilandroid/content/intent;)v  06-03 10:52:25.435 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x6f @ 0x02f4  06-03 10:52:25.435 7149-7149/xxx i/dalvikvm: not find method android.content.contextwrapper.getcodecachedir, referenced method xxx.mainactivity.access$super  06-03 10:52:25.435 7149-7149/xxx w/dalvikvm: vfy: unable resolve virtual method 564: landroid/content/contextwrapper;.getcodecachedir ()ljava/io/file;  06-03 10:52:25.435 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x6f @ 0x0349  06-03 10:52:25.440 7149-7149/xxx i/dalvikvm: dexopt: illegal method access (call landroid/support/v4/app/fragmentactivity;.dispatchfragmentsoncreateview (landroid/view/view;ljava/lang/string;landroid/content/context;landroid/util/attributeset;)landroid/view/view; lyyy/mainactivity;)  06-03 10:52:25.440 7149-7149/xxx i/dalvikvm: not find method android.support.v4.app.fragmentactivity.dispatchfragmentsoncreateview, referenced method xxx.mainactivity.access$super  06-03 10:52:25.440 7149-7149/xxx w/dalvikvm: vfy: unable resolve virtual method 2580: landroid/support/v4/app/fragmentactivity;.dispatchfragmentsoncreateview (landroid/view/view;ljava/lang/string;landroid/content/context;landroid/util/attributeset;)landroid/view/view;  06-03 10:52:25.440 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x6f @ 0x0432  06-03 10:52:25.440 7149-7149/xxx i/dalvikvm: not find method android.app.activity.getvoiceinteractor, referenced method xxx.mainactivity.access$super  06-03 10:52:25.440 7149-7149/xxx w/dalvikvm: vfy: unable resolve virtual method 91: landroid/app/activity;.getvoiceinteractor ()landroid/app/voiceinteractor;  06-03 10:52:25.440 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x6f @ 0x0490  06-03 10:52:25.440 7149-7149/xxx e/dalvikvm: not find class 'android.app.activitymanager$taskdescription', referenced method xxx.mainactivity.access$super  06-03 10:52:25.440 7149-7149/xxx w/dalvikvm: vfy: unable resolve check-cast 26 (landroid/app/activitymanager$taskdescription;) in lyyy/mainactivity;  06-03 10:52:25.440 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x1f @ 0x055b  06-03 10:52:25.440 7149-7149/xxx i/dalvikvm: not find method android.app.activity.startactionmode, referenced method xxx.mainactivity.access$super  06-03 10:52:25.440 7149-7149/xxx w/dalvikvm: vfy: unable resolve virtual method 223: landroid/app/activity;.startactionmode (landroid/view/actionmode$callback;i)landroid/view/actionmode;  06-03 10:52:25.440 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x6f @ 0x0596  06-03 10:52:25.440 7149-7149/xxx i/dalvikvm: not find method android.app.activity.showassist, referenced method xxx.mainactivity.access$super  06-03 10:52:25.440 7149-7149/xxx w/dalvikvm: vfy: unable resolve virtual method 218: landroid/app/activity;.showassist (landroid/os/bundle;)z  06-03 10:52:25.440 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x6f @ 0x05d8  06-03 10:52:25.440 7149-7149/xxx i/dalvikvm: not find method android.app.activity.postponeentertransition, referenced method xxx.mainactivity.access$super  06-03 10:52:25.440 7149-7149/xxx w/dalvikvm: vfy: unable resolve virtual method 176: landroid/app/activity;.postponeentertransition ()v  06-03 10:52:25.440 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x6f @ 0x05e3  06-03 10:52:25.440 7149-7149/xxx i/dalvikvm: not find method android.content.contextwrapper.getnobackupfilesdir, referenced method xxx.mainactivity.access$super  06-03 10:52:25.440 7149-7149/xxx w/dalvikvm: vfy: unable resolve virtual method 576: landroid/content/contextwrapper;.getnobackupfilesdir ()ljava/io/file;  06-03 10:52:25.440 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x6f @ 0x0672  06-03 10:52:25.445 7149-7149/xxx i/dalvikvm: not find method android.app.activity.requestpermissions, referenced method xxx.mainactivity.access$super  06-03 10:52:25.445 7149-7149/xxx w/dalvikvm: vfy: unable resolve virtual method 182: landroid/app/activity;.requestpermissions ([ljava/lang/string;i)v  06-03 10:52:25.445 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x6f @ 0x0787  06-03 10:52:25.445 7149-7149/xxx e/dalvikvm: not find class 'android.app.sharedelementcallback', referenced method xxx.mainactivity.access$super  06-03 10:52:25.445 7149-7149/xxx w/dalvikvm: vfy: unable resolve check-cast 57 (landroid/app/sharedelementcallback;) in lyyy/mainactivity;  06-03 10:52:25.445 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x1f @ 0x07a1  06-03 10:52:25.445 7149-7149/xxx e/dalvikvm: not find class 'android.os.persistablebundle', referenced method xxx.mainactivity.access$super  06-03 10:52:25.445 7149-7149/xxx w/dalvikvm: vfy: unable resolve check-cast 260 (landroid/os/persistablebundle;) in lyyy/mainactivity;  06-03 10:52:25.445 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x1f @ 0x07e8  06-03 10:52:25.445 7149-7149/xxx w/dalvikvm: dexopt: resolve class illegal access: lyyy/mainactivity; -> landroid/support/v4/app/basefragmentactivitydonut;  06-03 10:52:25.445 7149-7149/xxx i/dalvikvm: not find method android.support.v4.app.basefragmentactivitydonut.oncreateview, referenced method xxx.mainactivity.access$super  06-03 10:52:25.445 7149-7149/xxx w/dalvikvm: vfy: unable resolve virtual method 2356: landroid/support/v4/app/basefragmentactivitydonut;.oncreateview (ljava/lang/string;landroid/content/context;landroid/util/attributeset;)landroid/view/view;  06-03 10:52:25.445 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x6f @ 0x082c  06-03 10:52:25.445 7149-7149/xxx i/dalvikvm: not find method android.content.contextwrapper.getexternalfilesdirs, referenced method xxx.mainactivity.access$super  06-03 10:52:25.445 7149-7149/xxx w/dalvikvm: vfy: unable resolve virtual method 571: landroid/content/contextwrapper;.getexternalfilesdirs (ljava/lang/string;)[ljava/io/file;  06-03 10:52:25.445 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x6f @ 0x0882  06-03 10:52:25.445 7149-7149/xxx e/dalvikvm: not find class 'android.transition.transitionmanager', referenced method xxx.mainactivity.access$super  06-03 10:52:25.445 7149-7149/xxx w/dalvikvm: vfy: unable resolve check-cast 1829 (landroid/transition/transitionmanager;) in lyyy/mainactivity;  06-03 10:52:25.445 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x1f @ 0x093e  06-03 10:52:25.445 7149-7149/xxx i/dalvikvm: not find method android.app.activity.onprovidereferrer, referenced method xxx.mainactivity.access$super  06-03 10:52:25.445 7149-7149/xxx w/dalvikvm: vfy: unable resolve virtual method 152: landroid/app/activity;.onprovidereferrer ()landroid/net/uri;  06-03 10:52:25.445 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x6f @ 0x097e  06-03 10:52:25.445 7149-7149/xxx i/dalvikvm: dexopt: illegal method access (call landroid/support/v4/app/fragmentactivity;.doreallystop (z)v lyyy/mainactivity;)  06-03 10:52:25.445 7149-7149/xxx i/dalvikvm: not find method android.support.v4.app.fragmentactivity.doreallystop, referenced method xxx.mainactivity.access$super  06-03 10:52:25.445 7149-7149/xxx w/dalvikvm: vfy: unable resolve virtual method 2582: landroid/support/v4/app/fragmentactivity;.doreallystop (z)v  06-03 10:52:25.445 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x6f @ 0x09ab  06-03 10:52:25.450 7149-7149/xxx i/dalvikvm: not find method android.content.context.getdrawable, referenced method xxx.mainactivity.access$super  06-03 10:52:25.450 7149-7149/xxx w/dalvikvm: vfy: unable resolve virtual method 496: landroid/content/context;.getdrawable (i)landroid/graphics/drawable/drawable;  06-03 10:52:25.450 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x6f @ 0x09f5  06-03 10:52:25.450 7149-7149/xxx i/dalvikvm: not find method android.app.activity.showlocktaskescapemessage, referenced method xxx.mainactivity.access$super  06-03 10:52:25.450 7149-7149/xxx w/dalvikvm: vfy: unable resolve virtual method 221: landroid/app/activity;.showlocktaskescapemessage ()v  06-03 10:52:25.450 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x6f @ 0x0a05  06-03 10:52:25.450 7149-7149/xxx i/dalvikvm: not find method android.app.activity.getcontenttransitionmanager, referenced method xxx.mainactivity.access$super  06-03 10:52:25.450 7149-7149/xxx w/dalvikvm: vfy: unable resolve virtual method 66: landroid/app/activity;.getcontenttransitionmanager ()landroid/transition/transitionmanager;  06-03 10:52:25.450 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x6f @ 0x0a0b  06-03 10:52:25.450 7149-7149/xxx e/dalvikvm: not find class 'android.app.sharedelementcallback', referenced method xxx.mainactivity.access$super  06-03 10:52:25.450 7149-7149/xxx w/dalvikvm: vfy: unable resolve check-cast 57 (landroid/app/sharedelementcallback;) in lyyy/mainactivity;  06-03 10:52:25.450 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x1f @ 0x0ac7  06-03 10:52:25.450 7149-7149/xxx i/dalvikvm: not find method android.app.activity.getreferrer, referenced method xxx.mainactivity.access$super  06-03 10:52:25.450 7149-7149/xxx w/dalvikvm: vfy: unable resolve virtual method 80: landroid/app/activity;.getreferrer ()landroid/net/uri;  06-03 10:52:25.450 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x6f @ 0x0b3b  06-03 10:52:25.455 7149-7149/xxx i/dalvikvm: not find method android.content.contextwrapper.getsystemservicename, referenced method xxx.mainactivity.access$super  06-03 10:52:25.455 7149-7149/xxx w/dalvikvm: vfy: unable resolve virtual method 585: landroid/content/contextwrapper;.getsystemservicename (ljava/lang/class;)ljava/lang/string;  06-03 10:52:25.455 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x6f @ 0x0bb8  06-03 10:52:25.455 7149-7149/xxx i/dalvikvm: not find method android.app.activity.isvoiceinteractionroot, referenced method xxx.mainactivity.access$super  06-03 10:52:25.455 7149-7149/xxx w/dalvikvm: vfy: unable resolve virtual method 104: landroid/app/activity;.isvoiceinteractionroot ()z  06-03 10:52:25.455 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x6f @ 0x0be0  06-03 10:52:25.455 7149-7149/xxx i/dalvikvm: not find method android.content.contextwrapper.getexternalmediadirs, referenced method xxx.mainactivity.access$super  06-03 10:52:25.455 7149-7149/xxx w/dalvikvm: vfy: unable resolve virtual method 572: landroid/content/contextwrapper;.getexternalmediadirs ()[ljava/io/file;  06-03 10:52:25.455 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x6f @ 0x0c68  06-03 10:52:25.455 7149-7149/xxx i/dalvikvm: not find method android.app.activity.getmediacontroller, referenced method xxx.mainactivity.access$super  06-03 10:52:25.455 7149-7149/xxx w/dalvikvm: vfy: unable resolve virtual method 74: landroid/app/activity;.getmediacontroller ()landroid/media/session/mediacontroller;  06-03 10:52:25.455 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x6f @ 0x0cac  06-03 10:52:25.455 7149-7149/xxx i/dalvikvm: not find method android.app.activity.getsearchevent, referenced method xxx.mainactivity.access$super  06-03 10:52:25.455 7149-7149/xxx w/dalvikvm: vfy: unable resolve virtual method 83: landroid/app/activity;.getsearchevent ()landroid/view/searchevent;  06-03 10:52:25.455 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x6f @ 0x0d2b  06-03 10:52:25.455 7149-7149/xxx i/dalvikvm: dexopt: illegal method access (call landroid/support/v4/app/fragmentactivity;.onreallystop ()v lyyy/mainactivity;)  06-03 10:52:25.455 7149-7149/xxx i/dalvikvm: not find method android.support.v4.app.fragmentactivity.onreallystop, referenced method xxx.mainactivity.access$super  06-03 10:52:25.455 7149-7149/xxx w/dalvikvm: vfy: unable resolve virtual method 2616: landroid/support/v4/app/fragmentactivity;.onreallystop ()v  06-03 10:52:25.455 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x6f @ 0x0d6b  06-03 10:52:25.455 5258-5258/? d/abslistview: ondetachedfromwindow  06-03 10:52:25.455 7149-7149/xxx i/dalvikvm: not find method android.app.activity.isvoiceinteraction, referenced method xxx.mainactivity.access$super  06-03 10:52:25.455 7149-7149/xxx w/dalvikvm: vfy: unable resolve virtual method 103: landroid/app/activity;.isvoiceinteraction ()z  06-03 10:52:25.455 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x6f @ 0x0ddb  06-03 10:52:25.455 7149-7149/xxx i/dalvikvm: not find method android.app.activity.requestvisiblebehind, referenced method xxx.mainactivity.access$super  06-03 10:52:25.455 7149-7149/xxx w/dalvikvm: vfy: unable resolve virtual method 183: landroid/app/activity;.requestvisiblebehind (z)z  06-03 10:52:25.455 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x6f @ 0x0e40  06-03 10:52:25.455 7149-7149/xxx i/dalvikvm: not find method android.app.activity.shouldshowrequestpermissionrationale, referenced method xxx.mainactivity.access$super  06-03 10:52:25.455 7149-7149/xxx w/dalvikvm: vfy: unable resolve virtual method 216: landroid/app/activity;.shouldshowrequestpermissionrationale (ljava/lang/string;)z  06-03 10:52:25.455 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x6f @ 0x0e55  06-03 10:52:25.455 7149-7149/xxx i/dalvikvm: not find method android.app.activity.finishandremovetask, referenced method xxx.mainactivity.access$super

what have? main activity - having 7 buttons, each button has image background. buttons clickable, , on click of each button new activity started. so, if click button 1, activity1 started, on clicking button2, activity2 started , on. each of new activities, i.e., activity1, activity2, ... activity7 have image, app taking mipmap folder.

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>  <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"      xmlns:tools="http://schemas.android.com/tools"      xmlns:ads="http://schemas.android.com/apk/res-auto"      android:layout_width="match_parent"      android:layout_height="match_parent"      android:paddingbottom="@dimen/activity_vertical_margin"      android:paddingleft="@dimen/activity_horizontal_margin"      android:paddingright="@dimen/activity_horizontal_margin"      android:paddingtop="@dimen/activity_vertical_margin"      tools:context="xxx.mainactivity">       <button         android:layout_width="103dp"         android:layout_height="82dp"         android:id="@+id/btn_inside"         android:layout_below="@+id/ll_subheading1"         android:layout_centerhorizontal="true"         android:background="@mipmap/pic_small_inside"         style="@style/widget.appcompat.button.borderless"         android:clickable="true"/>       <button         android:layout_width="103dp"         android:layout_height="82dp"         android:id="@+id/btn_on_the_side1"         android:layout_below="@+id/ll_subheading2"         android:layout_alignparentleft="true"         android:layout_alignparentstart="true"         android:background="@mipmap/pic_small_on_the_side1"         style="@style/base.widget.appcompat.button.borderless"         android:clickable="true"/>       <button         android:layout_width="103dp"         android:layout_height="82dp"         android:id="@+id/btn_on_the_side3"         android:layout_below="@+id/ll_subheading2"         android:layout_alignparentright="true"         android:layout_alignparentend="true"         android:background="@mipmap/pic_small_on_the_side3"         style="@style/base.widget.appcompat.button.borderless"         android:clickable="true"/>       <button         android:layout_width="103dp"         android:layout_height="82dp"         android:id="@+id/btn_on_the_side2"         android:layout_aligntop="@+id/btn_on_the_side1"         android:layout_centerhorizontal="true"         android:background="@mipmap/pic_small_on_the_side2"         style="@style/base.widget.appcompat.button.borderless"         android:clickable="true"/>           </relativelayout>

mainactivity.java

public class mainactivity extends appcompatactivity {      private static button btn1, btn2, btn3, btn4, btn5, btn6, btn7;      @    override    protected void oncreate(bundle savedinstancestate) {      super.oncreate(savedinstancestate);      setcontentview(r.layout.activity_main);        onclickbuttonlistener();    }      public void onclickbuttonlistener() {      btn1 = (button) findviewbyid(r.id.btn_1);      btn1.setonclicklistener(new view.onclicklistener() {@        override        public void onclick(view v) {          intent intent_1 = new intent(mainactivity.this, mainactivity_1.class);          startactivity(intent_1);        }      });          btn2 = (button) findviewbyid(r.id.btn_2);      btn2.setonclicklistener(new view.onclicklistener() {@        override        public void onclick(view v) {          intent intent_2 = new intent(mainactivity.this, mainactivity_2.class);          startactivity(intent_2);        }      });        btn3 = (button) findviewbyid(r.id.btn_3);      btn3.setonclicklistener(new view.onclicklistener() {@        override        public void onclick(view v) {          intent intent_3 = new intent(mainactivity.this, mainactivity_3.class);          startactivity(intent_3);        }      });        btn4 = (button) findviewbyid(r.id.btn_4);      btn4.setonclicklistener(new view.onclicklistener() {@        override        public void onclick(view v) {          intent intent_4 = new intent(mainactivity.this, mainactivity_4.class);          startactivity(intent_4);        }      });        btn5 = (button) findviewbyid(r.id.btn_5);      btn5.setonclicklistener(new view.onclicklistener() {@        override        public void onclick(view v) {          intent intent_5 = new intent(mainactivity.this, mainactivity_5.class);          startactivity(intent_5);        }      });        btn6 = (button) findviewbyid(r.id.btn_6);      btn6.setonclicklistener(new view.onclicklistener() {@        override        public void onclick(view v) {          intent intent_6 = new intent(mainactivity.this, mainactivity_6.class);          startactivity(intent_6);        }      });        btn7 = (button) findviewbyid(r.id.btn_7);      btn7.setonclicklistener(new view.onclicklistener() {@        override        public void onclick(view v) {          intent intent_7 = new intent(mainactivity.this, mainactivity_7.class);          startactivity(intent_7);        }      });    }  }

logcat

05 - 25 23: 43: 17.209 17042 - 17042 < xx > w / < yy > : threadid = 1: thread exiting uncaught exception(group = 0x41e4e700)  05 - 25 23: 43: 17.209 17042 - 17042 < xx > e / androidruntime: fatal exception: main  java.lang.outofmemoryerror  @ android.graphics.bitmapfactory.nativedecodeasset(native method)  @ android.graphics.bitmapfactory.decodestream(bitmapfactory.java: 596)  @ android.graphics.bitmapfactory.decoderesourcestream(bitmapfactory.java: 444)  @ android.graphics.drawable.drawable.createfromresourcestream(drawable.java: 832)  @ android.content.res.resources.loaddrawable(resources.java: 2988)  @ android.content.res.typedarray.getdrawable(typedarray.java: 602)  @ android.view.view. < init > (view.java: 3563)  @ android.widget.textview. < init > (textview.java: 881)  @ android.widget.button. < init > (button.java: 108)  @ android.support.v7.widget.appcompatbutton. < init > (appcompatbutton.java: 62)  @ android.support.v7.widget.appcompatbutton. < init > (appcompatbutton.java: 58)  @ android.support.v7.app.appcompatviewinflater.createview(appcompatviewinflater.java: 105)  @ android.support.v7.app.appcompatdelegateimplv7.createview(appcompatdelegateimplv7.java: 972)  @ android.support.v7.app.appcompatdelegateimplv7.oncreateview(appcompatdelegateimplv7.java: 1030)  @ android.support.v4.view.layoutinflatercompathc$factorywrapperhc.oncreateview(layoutinflatercompathc.java: 44)  @ android.view.layoutinflater.createviewfromtag(layoutinflater.java: 690)  @ android.view.layoutinflater.rinflate(layoutinflater.java: 761)  @ android.view.layoutinflater.inflate(layoutinflater.java: 498)  @ android.view.layoutinflater.inflate(layoutinflater.java: 398)  @ android.view.layoutinflater.inflate(layoutinflater.java: 354)  @ android.support.v7.app.appcompatdelegateimplv7.setcontentview(appcompatdelegateimplv7.java: 276)  @ android.support.v7.app.appcompatactivity.setcontentview(appcompatactivity.java: 136)  @ abcpqr.red.mainactivity_1.oncreate(mainactivity_1.java: 21)  @ android.app.activity.performcreate(activity.java: 5372)  @ android.app.instrumentation.callactivityoncreate(instrumentation.java: 1104)  @ android.app.activitythread.performlaunchactivity(activitythread.java: 2257)  @ android.app.activitythread.handlelaunchactivity(activitythread.java: 2349)  @ android.app.activitythread.access$700(activitythread.java: 159)  t android.app.activitythread$h.handlemessage(activitythread.java: 1316)  @ android.os.handler.dispatchmessage(handler.java: 99)  @ android.os.looper.loop(looper.java: 176)  @ android.app.activitythread.main(activitythread.java: 5419)  @ java.lang.reflect.method.invokenative(native method)  @ java.lang.reflect.method.invoke(method.java: 525)  @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java: 1046)  @ com.android.internal.os.zygoteinit.main(zygoteinit.java: 862)  @ dalvik.system.nativestart.main(native method)  05 - 25 23: 43: 25.074 17042 - 17042 < xx > / process: sending signal.pid: 17042 sig: 9

what problem? having error of excess memory.

graphical representation of problem please see image below: enter image description here

please me? there better way of approaching such problem?

any appreciated. thanks!

1) make sure images best size highest density they'll displayed on. (if they're huge images being compressed they're taking lot of memory).

2) change buttons imagebuttons, clear out memory after during activity onstop():

    @override     protected void onstop(){         // controls images , makes sure          // they're not using memory once activity closed         drawable d = imagebutton1.getdrawable();         if (d != null) d.setcallback(null);         imagebutton1.setimagedrawable(null);     } 

just remember when want reload activity, you'll have redeclare imagebutton src.

    @override     protected void onresume(){         super.onresume();         imagebutton1.setimageresource(r.mipmap.pic_small_inside);     } 

Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

python 3.x - PyQt5 - Signal : pyqtSignal no method connect -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)