在src中,我有Announcement.java,MainActivity.java。
我想点击按钮后在MainActivity.java上调用Announcement.java。
<MainActivity>
Intent intent1 = new Intent(MainActivity.this, Announcement.class);
startActivity(intent1);
<Announcement>
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.announcement);
然而,它会出现意外的停止错误。我确认当我搬家时
意图intent1~Acmunment.class);
在公共类声明的正下方,我在模拟应用程序后出现意外。
我非常感谢你的帮助。
Android上的新生...... :(对不起。
这是logcat
08-18 08:42:57.044:D / AndroidRuntime(27901):关闭虚拟机
08-18 08:42:57.044:W / dalvikvm(27901):threadid = 1:线程退出 未捕获的异常(组= 0x41614ce0)
08-18 08:42:57.044:E / AndroidRuntime(27901):致命异常:主
08-18 08:42:57.044:E / AndroidRuntime(27901):流程: kr.hs.honam.honamhighschool,PID:27901
08-18 08:42:57.044:E / AndroidRuntime(27901): android.content.ActivityNotFoundException:无法找到显式 活动课 {kr.hs.honam.honamhighschool / kr.hs.honam.honamhighschool.Announcement}; 你有没有在AndroidManifest.xml中声明这个活动?
08-18 08:42:57.044:E / AndroidRuntime(27901):at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1628)
08-18 08:42:57.044:E / AndroidRuntime(27901):at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424)
08-18 08:42:57.044:E / AndroidRuntime(27901):at android.app.Activity.startActivityForResult(Activity.java:3424)
08-18 08:42:57.044:E / AndroidRuntime(27901):at android.app.Activity.startActivityForResult(Activity.java:3385)
08-18 08:42:57.044:E / AndroidRuntime(27901):at android.app.Activity.startActivity(Activity.java:3627)
08-18 08:42:57.044:E / AndroidRuntime(27901):at android.app.Activity.startActivity(Activity.java:3595)
08-18 08:42:57.044:E / AndroidRuntime(27901):at kr.hs.honam.honamhighschool.MainActivity.onOptionsItemSelected(MainActivity.java:41)
08-18 08:42:57.044:E / AndroidRuntime(27901):at android.app.Activity.onMenuItemSelected(Activity.java:2600)
08-18 08:42:57.044:E / AndroidRuntime(27901):at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:1065)
08-18 08:42:57.044:E / AndroidRuntime(27901):at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:741)
08-18 08:42:57.044:E / AndroidRuntime(27901):at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:152)
08-18 08:42:57.044:E / AndroidRuntime(27901):at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:884)
08-18 08:42:57.044:E / AndroidRuntime(27901):at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:874)
08-18 08:42:57.044:E / AndroidRuntime(27901):at com.android.internal.view.menu.MenuPopupHelper.onItemClick(MenuPopupHelper.java:177)
08-18 08:42:57.044:E / AndroidRuntime(27901):at android.widget.AdapterView.performItemClick(AdapterView.java:298)
08-18 08:42:57.044:E / AndroidRuntime(27901):at android.widget.AbsListView.performItemClick(AbsListView.java:1113)
08-18 08:42:57.044:E / AndroidRuntime(27901):at android.widget.AbsListView $ PerformClick.run(AbsListView.java:2911)
08-18 08:42:57.044:E / AndroidRuntime(27901):at android.widget.AbsListView $ 3.run(AbsListView.java:3645)
08-18 08:42:57.044:E / AndroidRuntime(27901):at android.os.Handler.handleCallback(Handler.java:733)
08-18 08:42:57.044:E / AndroidRuntime(27901):at android.os.Handler.dispatchMessage(Handler.java:95)
08-18 08:42:57.044:E / AndroidRuntime(27901):at android.os.Looper.loop(Looper.java:136)
08-18 08:42:57.044:E / AndroidRuntime(27901):at android.app.ActivityThread.main(ActivityThread.java:5139)
08-18 08:42:57.044:E / AndroidRuntime(27901):at java.lang.reflect.Method.invokeNative(Native Method)
08-18 08:42:57.044:E / AndroidRuntime(27901):at java.lang.reflect.Method.invoke(Method.java:515)
08-18 08:42:57.044:E / AndroidRuntime(27901):at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:796) 08-18 08:42:57.044:E / AndroidRuntime(27901):at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612)
08-18 08:42:57.044:E / AndroidRuntime(27901):at dalvik.system.NativeStart.main(原生方法)
答案 0 :(得分:1)
将清单活动添加到清单中。检查您的类型是否正确包装名称。