xml - Android application suddenly crashes -
i working on application on 2 weeks, , crashes everytime hit start button. it's important mention crashes on main phone (note 3) , on developer phone(100$ phone) works. log says xml file (it's popup window).
here log:
05-14 22:18:40.604 28373-28373/? e/dalvikvm-heap﹕ out of memory on 23289136-byte allocation. 05-14 22:18:40.614 28373-28373/? e/androidruntime﹕ fatal exception: main process: think.example.com.think, pid: 28373 java.lang.runtimeexception: unable start activity componentinfo{think.example.com.think/think.example.com.think.firstquestion}: android.view.inflateexception: binary xml file line #2: error inflating class <unknown> @ android.app.activitythread.performlaunchactivity(activitythread.java:2292) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2350) @ android.app.activitythread.access$800(activitythread.java:163) @ android.app.activitythread$h.handlemessage(activitythread.java:1257) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:157) @ android.app.activitythread.main(activitythread.java:5335) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(method.java:515) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1265) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:1081) @ dalvik.system.nativestart.main(native method) caused by: android.view.inflateexception: binary xml file line #2: error inflating class <unknown> @ android.view.layoutinflater.createview(layoutinflater.java:626) @ com.android.internal.policy.impl.phonelayoutinflater.oncreateview(phonelayoutinflater.java:56) @ android.view.layoutinflater.oncreateview(layoutinflater.java:675) @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:700) @ android.view.layoutinflater.inflate(layoutinflater.java:470) @ android.view.layoutinflater.inflate(layoutinflater.java:398) @ android.view.layoutinflater.inflate(layoutinflater.java:354) @ think.example.com.think.firstquestion.oncreate(firstquestion.java:70) @ android.app.activity.performcreate(activity.java:5389) @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1105) @ android.app.activitythread.performlaunchactivity(activitythread.java:2256) at android.app.activitythread.handlelaunchactivity(activitythread.java:2350) at android.app.activitythread.access$800(activitythread.java:163) at android.app.activitythread$h.handlemessage(activitythread.java:1257) at android.os.handler.dispatchmessage(handler.java:102) at android.os.looper.loop(looper.java:157) at android.app.activitythread.main(activitythread.java:5335) at java.lang.reflect.method.invokenative(native method) at java.lang.reflect.method.invoke(method.java:515) at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1265) at com.android.internal.os.zygoteinit.main(zygoteinit.java:1081) at dalvik.system.nativestart.main(native method) caused by: java.lang.reflect.invocationtargetexception @ java.lang.reflect.constructor.constructnative(native method) @ java.lang.reflect.constructor.newinstance(constructor.java:423) @ android.view.layoutinflater.createview(layoutinflater.java:600) at com.android.internal.policy.impl.phonelayoutinflater.oncreateview(phonelayoutinflater.java:56) at android.view.layoutinflater.oncreateview(layoutinflater.java:675) at android.view.layoutinflater.createviewfromtag(layoutinflater.java:700) at android.view.layoutinflater.inflate(layoutinflater.java:470) at android.view.layoutinflater.inflate(layoutinflater.java:398) at android.view.layoutinflater.inflate(layoutinflater.java:354) at think.example.com.think.firstquestion.oncreate(firstquestion.java:70) at android.app.activity.performcreate(activity.java:5389) at android.app.instrumentation.callactivityoncreate(instrumentation.java:1105) at android.app.activitythread.performlaunchactivity(activitythread.java:2256) at android.app.activitythread.handlelaunchactivity(activitythread.java:2350) at android.app.activitythread.access$800(activitythread.java:163) at android.app.activitythread$h.handlemessage(activitythread.java:1257) at android.os.handler.dispatchmessage(handler.java:102) at android.os.looper.loop(looper.java:157) at android.app.activitythread.main(activitythread.java:5335) at java.lang.reflect.method.invokenative(native method) at java.lang.reflect.method.invoke(method.java:515) at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1265) at com.android.internal.os.zygoteinit.main(zygoteinit.java:1081) at dalvik.system.nativestart.main(native method) caused by: java.lang.outofmemoryerror @ android.graphics.bitmapfactory.nativedecodeasset(native method) @ android.graphics.bitmapfactory.decodestream(bitmapfactory.java:677) @ android.graphics.bitmapfactory.decoderesourcestream(bitmapfactory.java:507) @ android.graphics.drawable.drawable.createfromresourcestream(drawable.java:872) @ android.content.res.resources.loaddrawable(resources.java:3054) @ android.content.res.typedarray.getdrawable(typedarray.java:602) @ android.view.view.<init>(view.java:3694) @ android.view.view.<init>(view.java:3624) @ android.view.viewgroup.<init>(viewgroup.java:474) @ android.widget.relativelayout.<init>(relativelayout.java:236) at java.lang.reflect.constructor.constructnative(native method) at java.lang.reflect.constructor.newinstance(constructor.java:423) at android.view.layoutinflater.createview(layoutinflater.java:600) at com.android.internal.policy.impl.phonelayoutinflater.oncreateview(phonelayoutinflater.java:56) at android.view.layoutinflater.oncreateview(layoutinflater.java:675) at android.view.layoutinflater.createviewfromtag(layoutinflater.java:700) at android.view.layoutinflater.inflate(layoutinflater.java:470) at android.view.layoutinflater.inflate(layoutinflater.java:398) at android.view.layoutinflater.inflate(layoutinflater.java:354) at think.example.com.think.firstquestion.oncreate(firstquestion.java:70) at android.app.activity.performcreate(activity.java:5389) at android.app.instrumentation.callactivityoncreate(instrumentation.java:1105) at android.app.activitythread.performlaunchactivity(activitythread.java:2256) at android.app.activitythread.handlelaunchactivity(activitythread.java:2350) at android.app.activitythread.access$800(activitythread.java:163) at android.app.activitythread$h.handlemessage(activitythread.java:1257) at android.os.handler.dispatchmessage(handler.java:102) at android.os.looper.loop(looper.java:157) at android.app.activitythread.main(activitythread.java:5335) at java.lang.reflect.method.invokenative(native method) at java.lang.reflect.method.invoke(method.java:515) at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1265) at com.android.internal.os.zygoteinit.main(zygoteinit.java:1081) at dalvik.system.nativestart.main(native method)
this xml file:
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/cluebackground" android:orientation="vertical" android:gravity="center" android:paddingtop="0dp" android:minwidth="300dp" android:minheight="400dp" > <imagebutton android:layout_width="40dp " android:layout_height="40dp" android:textstyle="bold" android:id="@+id/exit" android:background="@drawable/roundexit" android:layout_margintop="50dp" android:layout_marginleft="45dp" android:onclick="exitpopup" android:layout_gravity="top" /> <linearlayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_centerhorizontal="true" android:layout_alignparentright="true" android:layout_alignparentend="true" android:paddingtop="55dp" android:paddingright="50dp" android:paddingend="50dp" android:focusableintouchmode="false"> <imageview android:layout_width="21dp" android:layout_height="22dp" android:background="@drawable/coin" android:layout_margintop="6dp" android:layout_marginright="5dp" /> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="100" android:textsize="27sp" android:textcolor="#ffffffff" android:textstyle="bold" android:id="@+id/cluescore" /> </linearlayout> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" android:gravity="center" android:paddingtop="0dp"> <textview android:id="@+id/clue" android:layout_width="290dp" android:layout_height="wrap_content" android:gravity="center" android:text="it cost 50 coins clue" android:textsize="27dp" android:layout_marginbottom="40dp" android:textcolor="#fffefdff" android:layout_gravity="center" android:textstyle="bold" /> </linearlayout> <button android:layout_width="120dp" android:layout_height="50dp" android:text="get clue" android:layout_alignparentbottom="true" android:layout_centerinparent="true" android:layout_marginbottom="200dp" android:background="@drawable/stylepressed" android:onclick="getclue" /> </relativelayout>
i want mention if delete rows relate xml on java 'on create' method, works.
@override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_first_question); write = (edittext) findviewbyid(r.id.writeanswer); gamescore = (textview) findviewbyid(r.id.gamescore); //set popup menu inflater = (layoutinflater) firstquestion.this.getsystemservice(context.layout_inflater_service); layout = inflater.inflate(r.layout.menu, null); init(); popupinit(); //end of popup //clue popup cluescore = (textview) layout.findviewbyid(r.id.cluescore); clue = (textview) layout.findviewbyid(r.id.clue); //get score getting preferences sharedpreferences prefs = this.getsharedpreferences("score", context.mode_private); int savedscore = prefs.getint("key", 100); //0 default value** gamescore.settext(integer.tostring(savedscore)); cluescore.settext(gamescore.gettext().tostring()); //get score }
since have message in logcat
output:
caused by: android.view.inflateexception: binary xml file line #2: error inflating class <unknown> @ android.view.layoutinflater.createview(layoutinflater.java:626)
and outofmemoryerror
caused by: java.lang.outofmemoryerror @ android.graphics.bitmapfactory.nativedecodeasset(native method) @ android.graphics.bitmapfactory.decodestream(bitmapfactory.java:677) @ android.graphics.bitmapfactory.decoderesourcestream(bitmapfactory.java:507) @ android.graphics.drawable.drawable.createfromresourcestream(drawable.java:872) @ android.content.res.resources.loaddrawable(resources.java:3054) @ android.content.res.typedarray.getdrawable(typedarray.java:602)
some of images referenced layout has big size , need lot of memory displayed.
Comments
Post a Comment