android.content.ActivityNotFoundException:

前端 未结 24 2076
一生所求
一生所求 2020-11-22 10:38

I am getting this exception while I am trying to call an activity from another one. The complete exception is

android.content.ActivityNotFoundExcept

24条回答
  •  醉梦人生
    2020-11-22 11:22

    I also ran into ActivityNotFoundException by passing the wrong view into setContentView(), each activity's class file must correspond with the layout xml file this way.

    protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.wrongView);
    }
    

    as opposed to

    protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.correctView);
    }
    

提交回复
热议问题