我在我的智慧结束。我正在为我的消防部门开发一个应用程序,并且有一个我可能找不到的错误。我试图从我的第一个活动开始第二个活动,应用程序失败。 Logcat询问我是否已经宣布了我的活动,而且我有。
这是我的清单:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name">
<activity android:name="com.HCFD.scenenotes.BrushNotes" />
<activity
android:name="com.HCFD.scenenotes.MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme">"
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
这是意图:
Intent openBrushNotes = new Intent(this, BrushNotes.class);
以下是我的应用崩溃的电话:
public void openNewNotes(int a){
Log.i(TAG, "Open New Notes from button " + a);
switch(a){
case 1:
startActivity(openBrushNotes);
break;
有人能指出我正确的方向,我显然缺少什么?如果重要的话我在Windows 8.1下开发Eclipse ADT
我现在的整个BrushNotes:
package com.HCFD.scenenotes;
import android.app.Activity; import android.os.Bundle;
public class BrushNotes extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle brushBundle) {
super.onCreate(brushBundle);
setContentView(R.layout.brush_notes);
}
}
logcat的:
06-21 18:58:19.997: E/AndroidRuntime(21305): FATAL EXCEPTION: main
06-21 18:58:19.997: E/AndroidRuntime(21305): Process: com.HCFD.scenenotes, PID: 21305
06-21 18:58:19.997: E/AndroidRuntime(21305): android.content.ActivityNotFoundException: Unable to find explicit activity class {/com.HCFD.scenenotes.BrushNotes}; have you declared this activity in your AndroidManifest.xml?
06-21 18:58:19.997: E/AndroidRuntime(21305): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1648)
06-21 18:58:19.997: E/AndroidRuntime(21305): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1442)
06-21 18:58:19.997: E/AndroidRuntime(21305): at android.app.Activity.startActivityForResult(Activity.java:3474)
06-21 18:58:19.997: E/AndroidRuntime(21305): at android.app.Activity.startActivityForResult(Activity.java:3435)
06-21 18:58:19.997: E/AndroidRuntime(21305): at android.app.Activity.startActivity(Activity.java:3677)
06-21 18:58:19.997: E/AndroidRuntime(21305): at android.app.Activity.startActivity(Activity.java:3645)
06-21 18:58:19.997: E/AndroidRuntime(21305): at com.HCFD.scenenotes.MainActivity.openNewNotes(MainActivity.java:146)
06-21 18:58:19.997: E/AndroidRuntime(21305): at com.HCFD.scenenotes.MainActivity$2$1.onClick(MainActivity.java:125)
06-21 18:58:19.997: E/AndroidRuntime(21305): at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:167)
06-21 18:58:19.997: E/AndroidRuntime(21305): at android.os.Handler.dispatchMessage(Handler.java:102)
06-21 18:58:19.997: E/AndroidRuntime(21305): at android.os.Looper.loop(Looper.java:157)
06-21 18:58:19.997: E/AndroidRuntime(21305): at android.app.ActivityThread.main(ActivityThread.java:5293)
06-21 18:58:19.997: E/AndroidRuntime(21305): at java.lang.reflect.Method.invokeNative(Native Method)
06-21 18:58:19.997: E/AndroidRuntime(21305): at java.lang.reflect.Method.invoke(Method.java:515)
06-21 18:58:19.997: E/AndroidRuntime(21305): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
06-21 18:58:19.997: E/AndroidRuntime(21305): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
06-21 18:58:19.997: E/AndroidRuntime(21305): at dalvik.system.NativeStart.main(Native Method)