crash - Android app crashes and returns to menu and then works -


i'm writing app info on ingress. first app i'm kinda new android.

i have menu consist of 8 buttons. 1 of them opens activity has 2 imagebuttons. each imagebutton opens different activity has textview in it.

my problem this. when first run app crashes if hit either of image buttons. returns menu. if go either imagebutton, works.

i'm running app on gs4 running 4.2.2 debugging gave me error source not found. not sure whats wrong.

the class 2 buttons

public class factions extends activity implements view.onclicklistener { imagebutton resis, enligh; @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_factions);     setup(); }  private void setup() {     resis = (imagebutton) findviewbyid(r.id.ibresistance);     resis.setonclicklistener(this);      enligh = (imagebutton) findviewbyid(r.id.ibenlightened);     enligh.setonclicklistener(this); }  @override public boolean oncreateoptionsmenu(menu menu) {     // inflate menu; adds items action bar if present.     getmenuinflater().inflate(r.menu.factions, menu);     return true; }  @override public void onclick(view v) {     // todo auto-generated method stub     intent i;     switch (v.getid()) {     case r.id.ibenlightened:         = new intent(getapplicationcontext(), aboutenlightened.class);         startactivity(i);         break;      case r.id.ibresistance:         = new intent(getapplicationcontext(), aboutresistance.class);         startactivity(i);         break;     } } 

}

the xml class

<imagebutton     android:id="@+id/ibresistance"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_gravity="center"     android:layout_weight="1"     android:src="@drawable/resistance_logo_button" />  <imagebutton     android:id="@+id/ibenlightened"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_gravity="center"     android:layout_weight="1"     android:src="@drawable/enlightened_logo_button" /> 

the class 2 textviews have oncreate , oncreateoptionsmenu methods. don't need change them or add it. if need other info let me know. in advance.

the logcat shows this

08-09 22:07:00.541: i/dalvikvm(11028):   @ android.content.res.resources.loaddrawable(resources.java:2854)  08-09 22:07:00.541: i/dalvikvm(11028):   @ android.content.res.typedarray.getdrawable(typedarray.java:602)  08-09 22:07:00.541: i/dalvikvm(11028):   @ android.view.view.<init>(view.java:3460)     08-09 22:07:00.541: i/dalvikvm(11028):   @ android.view.viewgroup.<init>(viewgroup.java:446)  08-09 22:07:00.541: i/dalvikvm(11028):   @ android.widget.linearlayout.<init>(linearlayout.java:176)  08-09 22:07:00.541: i/dalvikvm(11028):   @ android.widget.linearlayout.<init>(linearlayout.java:172)  08-09 22:07:00.541: i/dalvikvm(11028):   @ java.lang.reflect.constructor.constructnative(native method)  08-09 22:07:00.541: i/dalvikvm(11028):   @ java.lang.reflect.constructor.newinstance(constructor.java:417)  08-09 22:07:00.541: i/dalvikvm(11028):   @ android.view.layoutinflater.createview(layoutinflater.java:593)  08-09 22:07:00.541: i/dalvikvm(11028):   @ com.android.internal.policy.impl.phonelayoutinflater.oncreateview(phonelayoutinflater.java:56)  08-09 22:07:00.541: i/dalvikvm(11028):   @ android.view.layoutinflater.oncreateview(layoutinflater.java:666)  08-09 22:07:00.541: i/dalvikvm(11028):   @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:691)  08-09 22:07:00.541: i/dalvikvm(11028):   @ android.view.layoutinflater.inflate(layoutinflater.java:467)  08-09 22:07:00.541: i/dalvikvm(11028):   @ android.view.layoutinflater.inflate(layoutinflater.java:397)  08-09 22:07:00.541: i/dalvikvm(11028):   @ android.view.layoutinflater.inflate(layoutinflater.java:353)  08-09 22:07:00.541: i/dalvikvm(11028):   @ com.android.internal.policy.impl.phonewindow.setcontentview(phonewindow.java:327)  08-09 22:07:00.541: i/dalvikvm(11028):   @ android.app.activity.setcontentview(activity.java:1928)  08-09 22:07:00.541: i/dalvikvm(11028):   @ com.kaveman.ingress.faqs.aboutresistance.oncreate(aboutresistance.java:12)  08-09 22:07:00.541: i/dalvikvm(11028):   @ android.app.activity.performcreate(activity.java:5250)  08-09 22:07:00.541: i/dalvikvm(11028):   @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1097)  08-09 22:07:00.541: i/dalvikvm(11028):   @ android.app.activitythread.performlaunchactivity(activitythread.java:2211)  08-09 22:07:00.541: i/dalvikvm(11028):   @ android.app.activitythread.handlelaunchactivity(activitythread.java:2297)  08-09 22:07:00.541: i/dalvikvm(11028):   @ android.app.activitythread.access$700(activitythread.java:152)  08-09 22:07:00.541: i/dalvikvm(11028):   @ android.app.activitythread$h.handlemessage(activitythread.java:1282)  08-09 22:07:00.541: i/dalvikvm(11028):   @ android.os.handler.dispatchmessage(handler.java:99)  08-09 22:07:00.541: i/dalvikvm(11028):   @ android.os.looper.loop(looper.java:137)  08-09 22:07:00.541: i/dalvikvm(11028):   @ android.app.activitythread.main(activitythread.java:5328)  08-09 22:07:00.541: i/dalvikvm(11028):   @ java.lang.reflect.method.invokenative(native method)  08-09 22:07:00.541: i/dalvikvm(11028):   @ java.lang.reflect.method.invoke(method.java:511)  08-09 22:07:00.541: i/dalvikvm(11028):   @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1102)  08-09 22:07:00.541: i/dalvikvm(11028):   @ com.android.internal.os.zygoteinit.main(zygoteinit.java:869)  08-09 22:07:00.541: i/dalvikvm(11028):   @ dalvik.system.nativestart.main(native method)  08-09 22:07:00.541: d/skia(11028): --- allocation failed scaled bitmap  08-09 22:07:00.541: d/androidruntime(11028): shutting down vm  08-09 22:07:00.541: w/dalvikvm(11028): threadid=1: thread exiting uncaught exception (group=0x41173ac8)  08-09 22:07:00.571: e/androidruntime(11028): fatal exception: main  08-09 22:07:00.571: e/androidruntime(11028): java.lang.runtimeexception: unable start activity componentinfo{com.kaveman.ingress.faqs/com.kaveman.ingress.faqs.aboutresistance}: android.view.inflateexception: binary xml file line #1: error inflating class <unknown>  08-09 22:07:00.571: e/androidruntime(11028):    @ android.app.activitythread.performlaunchactivity(activitythread.java:2247)  08-09 22:07:00.571: e/androidruntime(11028):    @ android.app.activitythread.handlelaunchactivity(activitythread.java:2297)  08-09 22:07:00.571: e/androidruntime(11028):    @ android.app.activitythread.access$700(activitythread.java:152)  08-09 22:07:00.571: e/androidruntime(11028):    @ android.app.activitythread$h.handlemessage(activitythread.java:1282)  08-09 22:07:00.571: e/androidruntime(11028):    @ android.os.handler.dispatchmessage(handler.java:99)  08-09 22:07:00.571: e/androidruntime(11028):    @ android.os.looper.loop(looper.java:137)  08-09 22:07:00.571: e/androidruntime(11028):    @ android.app.activitythread.main(activitythread.java:5328)  08-09 22:07:00.571: e/androidruntime(11028):    @ java.lang.reflect.method.invokenative(native method)  08-09 22:07:00.571: e/androidruntime(11028):    @ java.lang.reflect.method.invoke(method.java:511)  08-09 22:07:00.571: e/androidruntime(11028):    @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1102)  08-09 22:07:00.571: e/androidruntime(11028):    @ com.android.internal.os.zygoteinit.main(zygoteinit.java:869)  08-09 22:07:00.571: e/androidruntime(11028):    @ dalvik.system.nativestart.main(native method)  08-09 22:07:00.571: e/androidruntime(11028): caused by: android.view.inflateexception: binary xml file line #1: error inflating class <unknown>  08-09 22:07:00.571: e/androidruntime(11028):    @ android.view.layoutinflater.createview(layoutinflater.java:619)  08-09 22:07:00.571: e/androidruntime(11028):    @ com.android.internal.policy.impl.phonelayoutinflater.oncreateview(phonelayoutinflater.java:56)  08-09 22:07:00.571: e/androidruntime(11028):    @ android.view.layoutinflater.oncreateview(layoutinflater.java:666)  08-09 22:07:00.571: e/androidruntime(11028):    @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:691)  08-09 22:07:00.571: e/androidruntime(11028):    @ android.view.layoutinflater.inflate(layoutinflater.java:467)  08-09 22:07:00.571: e/androidruntime(11028):    @ android.view.layoutinflater.inflate(layoutinflater.java:397)  08-09 22:07:00.571: e/androidruntime(11028):    @ android.view.layoutinflater.inflate(layoutinflater.java:353)  08-09 22:07:00.571: e/androidruntime(11028):    @ com.android.internal.policy.impl.phonewindow.setcontentview(phonewindow.java:327)  08-09 22:07:00.571: e/androidruntime(11028):    @ android.app.activity.setcontentview(activity.java:1928)  08-09 22:07:00.571: e/androidruntime(11028):    @ com.kaveman.ingress.faqs.aboutresistance.oncreate(aboutresistance.java:12)  08-09 22:07:00.571: e/androidruntime(11028):    @ android.app.activity.performcreate(activity.java:5250)  08-09 22:07:00.571: e/androidruntime(11028):    @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1097)  08-09 22:07:00.571: e/androidruntime(11028):    @ android.app.activitythread.performlaunchactivity(activitythread.java:2211)  08-09 22:07:00.571: e/androidruntime(11028):    ... 11 more  08-09 22:07:00.571: e/androidruntime(11028): caused by: java.lang.reflect.invocationtargetexception  08-09 22:07:00.571: e/androidruntime(11028):    @ java.lang.reflect.constructor.constructnative(native method)  08-09 22:07:00.571: e/androidruntime(11028):    @ java.lang.reflect.constructor.newinstance(constructor.java:417)  08-09 22:07:00.571: e/androidruntime(11028):    @ android.view.layoutinflater.createview(layoutinflater.java:593)  08-09 22:07:00.571: e/androidruntime(11028):    ... 23 more  08-09 22:07:00.571: e/androidruntime(11028): caused by: java.lang.outofmemoryerror 08-09 22:07:00.571: e/androidruntime(11028):     @ android.graphics.bitmapfactory.nativedecodeasset(native method)  08-09 22:07:00.571: e/androidruntime(11028):    @ android.graphics.bitmapfactory.decodestream(bitmapfactory.java:596)  08-09 22:07:00.571: e/androidruntime(11028):    @ android.graphics.bitmapfactory.decoderesourcestream(bitmapfactory.java:444)  08-09 22:07:00.571: e/androidruntime(11028):    @ android.graphics.drawable.drawable.createfromresourcestream(drawable.java:817)  08-09 22:07:00.571: e/androidruntime(11028):    @ android.content.res.resources.loaddrawable(resources.java:2854)  08-09 22:07:00.571: e/androidruntime(11028):    @ android.content.res.typedarray.getdrawable(typedarray.java:602)  08-09 22:07:00.571: e/androidruntime(11028):    @ android.view.view.<init>(view.java:3460) 08-09 22:07:00.571: e/androidruntime(11028):    @ android.view.viewgroup.<init>(viewgroup.java:446)  08-09 22:07:00.571: e/androidruntime(11028):    @ android.widget.linearlayout.<init>(linearlayout.java:176)  08-09 22:07:00.571: e/androidruntime(11028):    @ android.widget.linearlayout.<init>(linearlayout.java:172)  08-09 22:07:00.571: e/androidruntime(11028):    ... 26 more 

this line should interested in:

caused by: java.lang.outofmemoryerror 08-09 22:07:00.571: e/androidruntime(11028):     @ android.graphics.bitmapfactory.nativedecodeasset(native method) 

are using android virtual device? try increasing vm in virtual device manager.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -