android中使用fragment时出现如下错误 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.fra

03-01 13:21:32.083: ERROR/AndroidRuntime(15285): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.fragmenttest/com.fragmenttest.MainActivity}: android.view.InflateException: Binary XML file line #11: Error inflating class fragment
03-01 13:21:32.083: ERROR/AndroidRuntime(15285):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2312)
03-01 13:21:32.083: ERROR/AndroidRuntime(15285):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2364)
03-01 13:21:32.083: ERROR/AndroidRuntime(15285):     at android.app.ActivityThread.access$600(ActivityThread.java:162)
03-01 13:21:32.083: ERROR/AndroidRuntime(15285):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1346)
03-01 13:21:32.083: ERROR/AndroidRuntime(15285):     at android.os.Handler.dispatchMessage(Handler.java:99)
03-01 13:21:32.083: ERROR/AndroidRuntime(15285):     at android.os.Looper.loop(Looper.java:153)
03-01 13:21:32.083: ERROR/AndroidRuntime(15285):     at android.app.ActivityThread.main(ActivityThread.java:5320)
03-01 13:21:32.083: ERROR/AndroidRuntime(15285):     at java.lang.reflect.Method.invokeNative(Native Method)
03-01 13:21:32.083: ERROR/AndroidRuntime(15285):     at java.lang.reflect.Method.invoke(Method.java:511)
03-01 13:21:32.083: ERROR/AndroidRuntime(15285):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
03-01 13:21:32.083: ERROR/AndroidRuntime(15285):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
03-01 13:21:32.083: ERROR/AndroidRuntime(15285):     at dalvik.system.NativeStart.main(Native Method)
03-01 13:21:32.083: ERROR/AndroidRuntime(15285): Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class fragment
03-01 13:21:32.083: ERROR/AndroidRuntime(15285):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
03-01 13:21:32.083: ERROR/AndroidRuntime(15285):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
03-01 13:21:32.083: ERROR/AndroidRuntime(15285):     at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
03-01 13:21:32.083: ERROR/AndroidRuntime(15285):     at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
03-01 13:21:32.083: ERROR/AndroidRuntime(15285):     at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
03-01 13:21:32.083: ERROR/AndroidRuntime(15285):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:274)
03-01 13:21:32.083: ERROR/AndroidRuntime(15285):     at android.app.Activity.setContentView(Activity.java:1927)
03-01 13:21:32.083: ERROR/AndroidRuntime(15285):     at com.fragmenttest.MainActivity.onCreate(MainActivity.java:11)
03-01 13:21:32.083: ERROR/AndroidRuntime(15285):     at android.app.Activity.performCreate(Activity.java:5208)
03-01 13:21:32.083: ERROR/AndroidRuntime(15285):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1081)
03-01 13:21:32.083: ERROR/AndroidRuntime(15285):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2276)
03-01 13:21:32.083: ERROR/AndroidRuntime(15285):     ... 11 more
03-01 13:21:32.083: ERROR/AndroidRuntime(15285): Caused by: java.lang.ClassCastException: com.fragmenttest.FragementList cannot be cast to android.app.Fragment
03-01 13:21:32.083: ERROR/AndroidRuntime(15285):     at android.app.Fragment.instantiate(Fragment.java:585)
03-01 13:21:32.083: ERROR/AndroidRuntime(15285):     at android.app.Fragment.instantiate(Fragment.java:560)
03-01 13:21:32.083: ERROR/AndroidRuntime(15285):     at android.app.Activity.onCreateView(Activity.java:4813)
03-01 13:21:32.083: ERROR/AndroidRuntime(15285):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
03-01 13:21:32.083: ERROR/AndroidRuntime(15285):     ... 21 more

报错详细内容如上;错误原因是:

引入Fragment包时引用的为:

android中使用fragment时出现如下错误 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.fra_第1张图片


这个错误时引错包所产生的问题,正确的引入

android中使用fragment时出现如下错误 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.fra_第2张图片

你可能感兴趣的:(android中使用fragment时出现如下错误 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.fra)