android - Unable to start activity componentinfo (error en setContentView) -
i know highlight topic, can't find mistake...
i have in .mainactivity
:
public class mainactivity extends activity{ ... public void abrirappmovimiento(view view) { intent mov = new intent(this, movimiento.class); startactivity(mov); } ... }
this androidmanifest.xml
:
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.emiliomorillanieto.practica3" > <application android:allowbackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name=".mainactivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:name=".movimiento" android:parentactivityname=".mainactivity" > <meta-data android:name="android.support.parent_activity" android:value=".mainactivity" /> </activity> </application> </manifest>
and class .movimiento
:
public class movimiento extends activity implements sensoreventlistener { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_movimiento); } }
i have being debugging app, , when app enters .movimiento
, savedinstancestate
null
, error comes while trying "setcontentview
".
why can possible, if have activity_movimiento.xml
defined in androidmanifest.xml
?
my activity_movimiento.xml
relativelayout
buttons play sound when it's touched. nothing special.
edit: activity_movimiento.xml
:
<?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="@color/gris_oscuro" android:orientation="vertical"> <button android:id="@+id/volver" style="?android:attr/buttonstylesmall" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:layout_alignparentleft="true" android:layout_alignparentstart="true" android:onclick="volveratras" android:text="volver" /> <textview android:id="@+id/tv_resultado" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:layout_centerhorizontal="true" android:layout_marginbottom="56dp" android:text="@string/resultado" android:textappearance="?android:attr/textappearancemedium" /> <imageview android:id="@+id/image_chew" android:layout_width="150px" android:layout_height="150px" android:layout_alignparenttop="true" android:layout_centerhorizontal="true" android:layout_margintop="63dp" android:src="@raw/chew_picture" /> <imageview android:id="@+id/image_laser" android:layout_width="150px" android:layout_height="150px" android:layout_alignparentend="true" android:layout_alignparentright="true" android:layout_centervertical="true" android:src="@raw/laser_picture" /> <imageview android:id="@+id/image_darth" android:layout_width="150px" android:layout_height="150px" android:layout_alignparentleft="true" android:layout_alignparentstart="true" android:layout_aligntop="@+id/image_laser" android:src="@raw/darth_picture" /> <imageview android:id="@+id/image_luke" android:layout_width="150px" android:layout_height="150px" android:layout_above="@+id/tv_resultado" android:layout_alignleft="@+id/image_chew" android:layout_alignstart="@+id/image_chew" android:src="@raw/luke_picture" /> </relativelayout>
and error:
02-08 11:12:29.126 9112-9112/com.example.emiliomorillanieto.practica3 e/androidruntime﹕ fatal exception: main java.lang.runtimeexception: unable start activity componentinfo{com.example.emiliomorillanieto.practica3/com.example.emiliomorillanieto.practica3.movimiento}: android.view.inflateexception: binary xml file line #39: error inflating class <unknown> @ android.app.activitythread.performlaunchactivity(activitythread.java:2305) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2363) @ android.app.activitythread.access$900(activitythread.java:161) @ android.app.activitythread$h.handlemessage(activitythread.java:1265) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:157) @ android.app.activitythread.main(activitythread.java:5356) @ 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 #39: error inflating class <unknown> … caused by: java.lang.reflect.invocationtargetexception … caused by: java.lang.outofmemoryerror …
the inflate exception not problem here , here comes issue in layout out of memory exception.
a common issue out of memory exception when trying inflate imageview loading drawable resource. if 1 of resources has high pixel resolution take lot of memory causing inflate exception.
so verify pixel resolution in drawables images minimum necessary layout.
checkout out of memory issue explaination.
hope helps.
Comments
Post a Comment