I know this is a highlight topic, but I can't find my mistake...
I have this in my .MainActivity
:
public class MainActivity extends Activity{
...
public void abrirAppMovimiento(View view) {
Intent mov = new Intent(this, Movimiento.class);
startActivity(mov);
}
...
}
This is my 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 this is the 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 the app, and when the app enters to .Movimiento
, savedInstanceState
is null
, but the error comes while trying to do "setContentView
".
Why can it be possible, if I have my activity_movimiento.xml
defined in AndroidManifest.xml
?
My activity_movimiento.xml
is a RelativeLayout
with some buttons that play a sound when it's touched. Nothing special.
EDIT:
This is my 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 the error:
02-08 11:12:29.126 9112-9112/com.example.emiliomorillanieto.practica3 E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.emiliomorillanieto.practica3/com.example.emiliomorillanieto.practica3.Movimiento}: android.view.InflateException: Binary XML file line #39: Error inflating class <unknown>
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2305)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2363)
at android.app.ActivityThread.access$900(ActivityThread.java:161)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5356)
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: android.view.InflateException: Binary XML file line #39: Error inflating class <unknown>
…
Caused by: java.lang.reflect.InvocationTargetException
…
Caused by: java.lang.OutOfMemoryError
…