ActivityNotFoundException 甚至为 Fragment 声明了操作



我有下面的代码:

public class Fragment1 扩展 Fragment 实现 View.OnClickListener {    按钮按钮;    @Override    public View onCreateView(LayoutInflower inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {        if(容器 == 空 )            返回空值;        View view = (LinearLayout)inflater.inflate(R.layout.fragment1_layout, container, false);        button = (Button) view.findViewById(R.id.button);        button.setOnClickListener(this);        返回视图;    }    @Override    public void onClick(View v) {        if(v.getId() == R.id.button) {            startActivity(new Intent(getActivity().getApplicationContext(), Fragment3.class));        }    }}

从Android开始,我什至在manifext中声明了一项活动.xml例如:

活动 Android:名称="Pachage...destiny_fragment"

连续显示

E/Android运行时:致命异常:main    android.content.ActivityNotFoundException: 无法找到显式活动类 {eguias.delogic.com.br.eguiasmobile/eguias.delogic.com.br.eguiasmobile.Fragment3};您是否在 AndroidManifest .xml 中声明了此活动?            at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1541)            at android.app.Instrumentation.execStartActivity(Instrumentation.java:1416)            at android.app.Activity.startActivityForResult(Activity.java:3351)            at android.app.Activity.startActivityForResult(Activity.java:3312)            at android.support.v4.app.FragmentActivity.startActivityFromFragment(FragmentActivity.java:826)            at android.support.v4.app.Fragment.startActivity(Fragment.java:896)            at eguias.delogic.com.br.eguiasmobile.Fragment1.onClick(Fragment1.java:37)            at android.view.View.performClick(View.java:4084)            at android.view.View$PerformClick.run(View.java:16966)            at android.os.Handler.handleCallback(Handler.java:615)            at android.os.Handler.dispatchMessage(Handler.java:92)            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)

应用程序正常运行,但错误"android.content.ActivityNotFoundException"始终显示在logcat中。

谢谢。

您的Fragment3.class应该扩展Activity,这应该在 AndroidManifest.xml 中声明。

main

    android.content.ActivityNotFoundException: Unable to find explicit activity class {com.shamsan.droplivelast1/com.shamsan.droplivelast1.Reqlist}; have you declared this activity in your AndroidManifest.xml?
 at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1556)
 at android.app.Instrumentation.execStartActivity(Instrumentation.java:1431)
 at android.app.Activity.startActivityForResult(Activity.java:3417)
at android.support.v4.app.BaseFragmentActivityJB.startActivityForResult(BaseFragmentActivityJB.java:50)

相关内容

  • 没有找到相关文章

最新更新