Android project gives InflateException error.
And this is the error from the Android Studio Android Monitor:
--------- beginning of crash 07-14 00:03:23.801 13726-13726/com.example.romi.parcelablecreatortest E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.romi.parcelablecreatortest, PID: 13726 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.romi.parcelablecreatortest/com.example.romi.parcelablecreatortest.MainActivity}: android.view.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class fragment at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) at android.app.ActivityThread.-wrap11(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) Caused by: android.view.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class fragment at android.view.LayoutInflater.inflate(LayoutInflater.java:539) at android.view.LayoutInflater.inflate(LayoutInflater.java:423) at android.view.LayoutInflater.inflate(LayoutInflater.java:374) at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280) at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) at com.example.romi.parcelablecreatortest.MainActivity.onCreate(MainActivity.java:11)
Here is the code:
activity_main.xml
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/fragment"
android:name="com.example.romi.parcelablecreatortest.MainActivityFragment"
android:layout="@layout/activity_main_activity_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
MainActivity.java
package com.example.romi.parcelablecreatortest;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
public class MainActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}