設定画面へのインテントを起動したいときに強制終了に遭遇しました。マニフェストで宣言した後でも、この問題に遭遇します。
マニフェスト
<activity android:name=".Preferences" ></activity>
MainActivity からのインテントの起動
Intent startPreference = new Intent(MainActivity.this,Preferences.class);
startActivity(startPreference);
設定画面
public class Preferences extends PreferenceActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
}
}
それでも私が意図を開くたびに、私は出会いました
10-04 14:02:45.088: E/AndroidRuntime(11201): android.content.ActivityNotFoundException: Unable to find explicit activity class {dev.example.activity/java.util.prefs.Preferences}; have you declared this activity in your AndroidManifest.xml?
編集:完全なマニフェスト
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="dev.example.activity"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<application
android:icon="@drawable/ic_launcher"
android:label="Example"
android:theme="@android:style/Theme.Light.NoTitleBar" >
<activity
android:name=".MainActivity"
android:label="Example" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Individual"
android:label="Example" >
</activity>
<activity android:name="dev.example.activity.Preferences" >
</activity>
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
</manifest>
完全なログキャット
10-04 14:24:35.408: E/AndroidRuntime(12936): FATAL EXCEPTION: main
10-04 14:24:35.408: E/AndroidRuntime(12936): android.content.ActivityNotFoundException: Unable to find explicit activity class {dev.example.activity/java.util.prefs.Preferences}; have you declared this activity in your AndroidManifest.xml?
10-04 14:24:35.408: E/AndroidRuntime(12936): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1405)
10-04 14:24:35.408: E/AndroidRuntime(12936): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379)
10-04 14:24:35.408: E/AndroidRuntime(12936): at android.app.Activity.startActivityForResult(Activity.java:2827)
10-04 14:24:35.408: E/AndroidRuntime(12936): at android.app.Activity.startActivity(Activity.java:2933)
10-04 14:24:35.408: E/AndroidRuntime(12936): at dev.shaunidiot.mycolorscreen.MainActivity.onOptionsItemSelected(MainActivity.java:166)
10-04 14:24:35.408: E/AndroidRuntime(12936): at android.app.Activity.onMenuItemSelected(Activity.java:2205)
10-04 14:24:35.408: E/AndroidRuntime(12936): at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:768)
10-04 14:24:35.408: E/AndroidRuntime(12936): at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:147)
10-04 14:24:35.408: E/AndroidRuntime(12936): at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:855)
10-04 14:24:35.408: E/AndroidRuntime(12936): at com.android.internal.view.menu.IconMenuView.invokeItem(IconMenuView.java:532)
10-04 14:24:35.408: E/AndroidRuntime(12936): at com.android.internal.view.menu.IconMenuItemView.performClick(IconMenuItemView.java:122)
10-04 14:24:35.408: E/AndroidRuntime(12936): at android.view.View$PerformClick.run(View.java:9229)
10-04 14:24:35.408: E/AndroidRuntime(12936): at android.os.Handler.handleCallback(Handler.java:587)
10-04 14:24:35.408: E/AndroidRuntime(12936): at android.os.Handler.dispatchMessage(Handler.java:92)
10-04 14:24:35.408: E/AndroidRuntime(12936): at android.os.Looper.loop(Looper.java:130)
10-04 14:24:35.408: E/AndroidRuntime(12936): at android.app.ActivityThread.main(ActivityThread.java:3701)
10-04 14:24:35.408: E/AndroidRuntime(12936): at java.lang.reflect.Method.invokeNative(Native Method)
10-04 14:24:35.408: E/AndroidRuntime(12936): at java.lang.reflect.Method.invoke(Method.java:507)
10-04 14:24:35.408: E/AndroidRuntime(12936): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
10-04 14:24:35.408: E/AndroidRuntime(12936): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624)
10-04 14:24:35.408: E/AndroidRuntime(12936): at dalvik.system.NativeStart.main(Native Method)