我已经创建了一个登录页面。成功登录后,应该打开一个导航抽屉活动。但是当我运行项目时,导航抽屉活动没有打开。
我在login.java中使用以下代码:
if((userName.equals("admin"))&&(userPassword.equals("123"))){
Intent intent=new Intent(login.this,nevactivity.class);
startActivity(intent);}
我还在清单文件中添加了意图过滤器。
这是堆栈跟踪:
09-22 12:59:21.838 6356-6356/com.admin.demo1 E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.admin.demo1, PID: 6356
java.lang.RuntimeException: com.admin.demo1.MainActivity@1ebcca7 must implement OnFragmentInteractionListener
at com.admin.demo1.mapFragment.onAttach(mapFragment.java:103)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1404)
at android.support.v4.app.FragmentTransition.addToFirstInLastOut(FragmentTransition.java:1195)
at android.support.v4.app.FragmentTransition.calculateFragments(FragmentTransition.java:1078)
at android.support.v4.app.FragmentTransition.startTransitions(FragmentTransition.java:117)
at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2408)
at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2366)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2273)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:733)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)