我一直在打电话首选项.java类使用:
Intent settingsActivity = new Intent(getBaseContext(), Preferences.class);
startActivity(settingsActivity);
我有这个在我的房间里清单.xml(在主要应用程序类活动之外):
<application>
........
<activity android:name=".Preferences" android:label="Preferences">
</activity>
</application>
E/AndroidRuntime(25644): FATAL EXCEPTION: main
E/AndroidRuntime(25644): android.content.ActivityNotFoundException: Unable to fi
nd explicit activity class {com./java.util.prefs.Preferences};
have you declared this activity in your AndroidManifest.xml?
E/AndroidRuntime(25644): at android.app.Instrumentation.checkStartActivit
yResult(Instrumentation.java:1404)
E/AndroidRuntime(25644): at android.app.Instrumentation.execStartActivity
(Instrumentation.java:1378)
E/AndroidRuntime(25644): at android.app.Activity.startActivityForResult(A
ctivity.java:2817)
E/AndroidRuntime(25644): at android.app.Activity.startActivity(Activity.j
ava:2923)
E/AndroidRuntime(25644): at com.droidil.droidmarks.Dmarks.onOptionsItemSe
lected(Dmarks.java:337)
E/AndroidRuntime(25644): at android.app.Activity.onMenuItemSelected(Activ
ity.java:2195)
E/AndroidRuntime(25644): at com.android.internal.policy.impl.PhoneWindow.
onMenuItemSelected(PhoneWindow.java:730)
E/AndroidRuntime(25644): at com.android.internal.view.menu.MenuItemImpl.i
nvoke(MenuItemImpl.java:143)
E/AndroidRuntime(25644): at com.android.internal.view.menu.MenuBuilder.pe
rformItemAction(MenuBuilder.java:855)
E/AndroidRuntime(25644): at com.android.internal.view.menu.IconMenuView.i
nvokeItem(IconMenuView.java:532)
E/AndroidRuntime(25644): at com.android.internal.view.menu.IconMenuItemVi
ew.performClick(IconMenuItemView.java:122)
E/AndroidRuntime(25644): at android.view.View$PerformClick.run(View.java:
8818)
E/AndroidRuntime(25644): at android.os.Handler.handleCallback(Handler.jav
a:587)
E/AndroidRuntime(25644): at android.os.Handler.dispatchMessage(Handler.ja
va:92)
E/AndroidRuntime(25644): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime(25644): at android.app.ActivityThread.main(ActivityThrea
d.java:4627)
E/AndroidRuntime(25644): at java.lang.reflect.Method.invokeNative(Native
Method)
E/AndroidRuntime(25644): at java.lang.reflect.Method.invoke(Method.java:5
21)
E/AndroidRuntime(25644): at com.android.internal.os.ZygoteInit$MethodAndA
rgsCaller.run(ZygoteInit.java:868)
E/AndroidRuntime(25644): at com.android.internal.os.ZygoteInit.main(Zygot
eInit.java:626)
E/AndroidRuntime(25644): at dalvik.system.NativeStart.main(Native Method)
没有编译错误。。。只是这个运行时错误。。。
你知道为什么它会强制关闭吗,即使我在清单.xml?
谢谢你的帮助!