java - ImageButton with JPEG source causes InflateException -
java - ImageButton with JPEG source causes InflateException -
i have 15 imagebuttons
src attribute set jpeg
picture:
<imagebutton android:id="@+id/button01" android:layout_width="fill_parent" android:layout_height="match_parent" android:layout_weight="0.2" android:padding="5dp" android:scaletype="fitcenter" android:adjustviewbounds="true" android:background="@drawable/button_state" android:src="@drawable/agri_b" />
when run application inflateexception
error. tried alter activity
class fragmentactivity
class nil changed. guess wrong jpeg
image size. largest image has 217 kb size. here error get:
10-18 12:27:32.538: e/androidruntime(30713): fatal exception: main 10-18 12:27:32.538: e/androidruntime(30713): process: com.example.traceyourexpense, pid: 30713 10-18 12:27:32.538: e/androidruntime(30713): java.lang.runtimeexception: unable start activity componentinfo{com.example.traceyourexpense/com.example.traceyourexpense.newbank}: android.view.inflateexception: binary xml file line #263: error inflating class <unknown> 10-18 12:27:32.538: e/androidruntime(30713): @ android.app.activitythread.performlaunchactivity(activitythread.java:2395) 10-18 12:27:32.538: e/androidruntime(30713): @ android.app.activitythread.handlelaunchactivity(activitythread.java:2453) 10-18 12:27:32.538: e/androidruntime(30713): @ android.app.activitythread.access$900(activitythread.java:173) 10-18 12:27:32.538: e/androidruntime(30713): @ android.app.activitythread$h.handlemessage(activitythread.java:1303) 10-18 12:27:32.538: e/androidruntime(30713): @ android.os.handler.dispatchmessage(handler.java:102) 10-18 12:27:32.538: e/androidruntime(30713): @ android.os.looper.loop(looper.java:136) 10-18 12:27:32.538: e/androidruntime(30713): @ android.app.activitythread.main(activitythread.java:5579) 10-18 12:27:32.538: e/androidruntime(30713): @ java.lang.reflect.method.invokenative(native method) 10-18 12:27:32.538: e/androidruntime(30713): @ java.lang.reflect.method.invoke(method.java:515) 10-18 12:27:32.538: e/androidruntime(30713): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1268) 10-18 12:27:32.538: e/androidruntime(30713): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:1084) 10-18 12:27:32.538: e/androidruntime(30713): @ dalvik.system.nativestart.main(native method) 10-18 12:27:32.538: e/androidruntime(30713): caused by: android.view.inflateexception: binary xml file line #263: error inflating class <unknown> 10-18 12:27:32.538: e/androidruntime(30713): @ android.view.layoutinflater.createview(layoutinflater.java:626) 10-18 12:27:32.538: e/androidruntime(30713): @ com.android.internal.policy.impl.phonelayoutinflater.oncreateview(phonelayoutinflater.java:56) 10-18 12:27:32.538: e/androidruntime(30713): @ android.view.layoutinflater.oncreateview(layoutinflater.java:675) 10-18 12:27:32.538: e/androidruntime(30713): @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:700) 10-18 12:27:32.538: e/androidruntime(30713): @ android.view.layoutinflater.rinflate(layoutinflater.java:761) 10-18 12:27:32.538: e/androidruntime(30713): @ android.view.layoutinflater.rinflate(layoutinflater.java:769) 10-18 12:27:32.538: e/androidruntime(30713): @ android.view.layoutinflater.rinflate(layoutinflater.java:769) 10-18 12:27:32.538: e/androidruntime(30713): @ android.view.layoutinflater.inflate(layoutinflater.java:498) 10-18 12:27:32.538: e/androidruntime(30713): @ android.view.layoutinflater.inflate(layoutinflater.java:398) 10-18 12:27:32.538: e/androidruntime(30713): @ android.view.layoutinflater.inflate(layoutinflater.java:354) 10-18 12:27:32.538: e/androidruntime(30713): @ com.android.internal.policy.impl.phonewindow.setcontentview(phonewindow.java:366) 10-18 12:27:32.538: e/androidruntime(30713): @ android.app.activity.setcontentview(activity.java:2031) 10-18 12:27:32.538: e/androidruntime(30713): @ com.example.traceyourexpense.newbank.oncreate(newbank.java:51) 10-18 12:27:32.538: e/androidruntime(30713): @ android.app.activity.performcreate(activity.java:5451) 10-18 12:27:32.538: e/androidruntime(30713): @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1093) 10-18 12:27:32.538: e/androidruntime(30713): @ android.app.activitythread.performlaunchactivity(activitythread.java:2359) 10-18 12:27:32.538: e/androidruntime(30713): ... 11 more 10-18 12:27:32.538: e/androidruntime(30713): caused by: java.lang.reflect.invocationtargetexception 10-18 12:27:32.538: e/androidruntime(30713): @ java.lang.reflect.constructor.constructnative(native method) 10-18 12:27:32.538: e/androidruntime(30713): @ java.lang.reflect.constructor.newinstance(constructor.java:423) 10-18 12:27:32.538: e/androidruntime(30713): @ android.view.layoutinflater.createview(layoutinflater.java:600) 10-18 12:27:32.538: e/androidruntime(30713): ... 26 more 10-18 12:27:32.538: e/androidruntime(30713): caused by: java.lang.outofmemoryerror 10-18 12:27:32.538: e/androidruntime(30713): @ android.graphics.bitmapfactory.nativedecodeasset(native method) 10-18 12:27:32.538: e/androidruntime(30713): @ android.graphics.bitmapfactory.decodestream(bitmapfactory.java:683) 10-18 12:27:32.538: e/androidruntime(30713): @ android.graphics.bitmapfactory.decoderesourcestream(bitmapfactory.java:513) 10-18 12:27:32.538: e/androidruntime(30713): @ android.graphics.drawable.drawable.createfromresourcestream(drawable.java:889) 10-18 12:27:32.538: e/androidruntime(30713): @ android.content.res.resources.loaddrawable(resources.java:3454) 10-18 12:27:32.538: e/androidruntime(30713): @ android.content.res.typedarray.getdrawable(typedarray.java:602) 10-18 12:27:32.538: e/androidruntime(30713): @ android.widget.imageview.<init>(imageview.java:133) 10-18 12:27:32.538: e/androidruntime(30713): @ android.widget.imagebutton.<init>(imagebutton.java:88) 10-18 12:27:32.538: e/androidruntime(30713): @ android.widget.imagebutton.<init>(imagebutton.java:84) 10-18 12:27:32.538: e/androidruntime(30713): ... 29 more
any help appreciated.
edit-1
to check if error related image size, removed image sources imagebuttons
unexpectedly error again!! problem guys?
try
android:layout_width="0dp"
(if images displayed horizontally within parent view) or
android:layout_height="0dp"
(if they're displayed vertically within parent). if you're using layout_weight
, either width or height of image should 0dp.
java android xml android-layout
Comments
Post a Comment