-1

我在尝试使用 Fragment 启动活动时遇到以下错误

08-09 13:50:57.070: ERROR/AndroidRuntime(1446): FATAL EXCEPTION: main
        java.lang.RuntimeException: Unable to start activity ComponentInfo{br.com.zap.imoveis/br.com.zap.imoveis.ui.ResultadoBusca}: android.view.InflateException: Binary XML file line #8: Error inflating class fragment
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
        at android.app.ActivityThread.access$600(ActivityThread.java:130)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:137)
        at android.app.ActivityThread.main(ActivityThread.java:4745)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:511)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
        at dalvik.system.NativeStart.main(Native Method)
        Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class fragment
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
        at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
        at com.actionbarsherlock.internal.ActionBarSherlockNative.setContentView(ActionBarSherlockNative.java:133)
        at com.actionbarsherlock.app.SherlockFragmentActivity.setContentView(SherlockFragmentActivity.java:261)
        at br.com.zap.imoveis.ui.ResultadoBusca.onCreate(ResultadoBusca.java:54)
        at android.app.Activity.performCreate(Activity.java:5008)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
        ... 11 more
        Caused by: java.lang.ClassCastException: br.com.zap.imoveis.ui.ResultadoBuscaMapa cannot be cast to android.app.Fragment
        at android.app.Fragment.instantiate(Fragment.java:577)
        at android.app.Fragment.instantiate(Fragment.java:552)
        at android.app.Activity.onCreateView(Activity.java:4656)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
        ... 22 more

尽管它在这里说: 无法转换为 android.app.Fragment

即使我的活动从 android.support.v4.app.FragmentActivity

4

1 回答 1

0

不幸的是,有时错误消息非常具有误导性。我几乎重建了我的应用程序,发现在重构期间我不小心删除了这行代码

super.onCreate(savedInstanceState);

关于onCreate我的活动方法。

于 2013-08-09T17:17:28.537 回答