Q
q-jack
Neues Mitglied
- 0
Hallo Leute,
stehe in meinem Vorhaben etwas auf dem Schlauch. Hoffe ich finde hier etwas Hilfe.
Und zwar habe ich zwei Activities:
Die StartActivity hat einen Button. Dieser soll die beim Klick die GameActivity ausführen.
Ich bekomme den Button angezeigt aber sobald ich den betätige bekomme ich eine Fehlermeldung die sagt:
Ich habe die Activities aber in das Manifest eingetragen. Ich vermute es ist ein dummer Fehler, aber ich bin schon etwas CodeBlind und hoffe auf eure Hilfe.
Hier noch der Code von der StartActivity
Und hier das Manifest ich denke, dass reicht an Code oder?
Hoffe auf eure Hilfe!
Danke
stehe in meinem Vorhaben etwas auf dem Schlauch. Hoffe ich finde hier etwas Hilfe.
Und zwar habe ich zwei Activities:
- TowerDefenseGameActivity
- TowerDefenseStartActivity
Die StartActivity hat einen Button. Dieser soll die beim Klick die GameActivity ausführen.
Ich bekomme den Button angezeigt aber sobald ich den betätige bekomme ich eine Fehlermeldung die sagt:
09-24 17:27:23.895: W/dalvikvm(32627): threadid=1: thread exiting with uncaught exception (group=0x40c5e1f8)
09-24 17:27:23.905: E/AndroidRuntime(32627): FATAL EXCEPTION: main
09-24 17:27:23.905: E/AndroidRuntime(32627): android.content.ActivityNotFoundException: Unable to find explicit activity class {/com.example.towerdefense.TowerDefenseGameActivity}; have you declared this activity in your AndroidManifest.xml?
09-24 17:27:23.905: E/AndroidRuntime(32627): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1512)
09-24 17:27:23.905: E/AndroidRuntime(32627): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1388)
09-24 17:27:23.905: E/AndroidRuntime(32627): at android.app.Activity.startActivityForResult(Activity.java:3252)
09-24 17:27:23.905: E/AndroidRuntime(32627): at android.app.Activity.startActivity(Activity.java:3359)
09-24 17:27:23.905: E/AndroidRuntime(32627): at com.example.towerdefense.TowerDefenseStartActivity$1.onClick(TowerDefenseStartActivity.java:30)
09-24 17:27:23.905: E/AndroidRuntime(32627): at android.view.View.performClick(View.java:3644)
09-24 17:27:23.905: E/AndroidRuntime(32627): at android.view.View$PerformClick.run(View.java:14313)
09-24 17:27:23.905: E/AndroidRuntime(32627): at android.os.Handler.handleCallback(Handler.java:605)
09-24 17:27:23.905: E/AndroidRuntime(32627): at android.os.Handler.dispatchMessage(Handler.java:92)
09-24 17:27:23.905: E/AndroidRuntime(32627): at android.os.Looper.loop(Looper.java:137)
09-24 17:27:23.905: E/AndroidRuntime(32627): at android.app.ActivityThread.main(ActivityThread.java:4517)
09-24 17:27:23.905: E/AndroidRuntime(32627): at java.lang.reflect.Method.invokeNative(Native Method)
09-24 17:27:23.905: E/AndroidRuntime(32627): at java.lang.reflect.Method.invoke(Method.java:511)
09-24 17:27:23.905: E/AndroidRuntime(32627): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
09-24 17:27:23.905: E/AndroidRuntime(32627): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
09-24 17:27:23.905: E/AndroidRuntime(32627): at dalvik.system.NativeStart.main(Native Method)
Ich habe die Activities aber in das Manifest eingetragen. Ich vermute es ist ein dummer Fehler, aber ich bin schon etwas CodeBlind und hoffe auf eure Hilfe.
Hier noch der Code von der StartActivity
Code:
package com.example.towerdefense;
import android.app.Activity;
import android.util.Log;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class TowerDefenseStartActivity extends Activity {
private Button playButton;
Intent myIntent = new Intent(this, TowerDefenseGameActivity.class);
@Override
protected void onCreate(Bundle icicle) {
Log.i(getPackageName(), "Intent " + myIntent.toString());
super.onCreate(icicle);
this.setContentView(R.layout.main);
this.playButton = (Button) this.findViewById(R.id.start);
this.playButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(myIntent);
}
});
}
}
Und hier das Manifest ich denke, dass reicht an Code oder?
Code:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.towerdefense"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".TowerDefenseStartActivity"
android:label="@string/title_activity_tower_defense_game" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".TowerDefenseGameActivity"
android:label="@string/app_name" >
</activity>
</application>
</manifest>
Hoffe auf eure Hilfe!
Danke