Activity aus einer anderen heraus aufrufen

  • 7 Antworten
  • Letztes Antwortdatum
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:
  • 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
 
q-jack schrieb:
Hallo Leute,

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:



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

Wie der Error schon sagt musst du in der Manifest.xml die Activitys angeben die du benutzt. Das hast du auch gemacht aber glaube ich nicht ganz korrekt.

Code:
 <activity android:name=".TowerDefenseGameActivity"
       android:label="@string/app_name" />

so geht es glaube ich

statt

Code:
<activity
            android:name=".TowerDefenseGameActivity"
            android:label="@string/app_name" >
        </activity>
 
@ IxSparky:
Nein, der Fehler liegt gewiss nicht bei der Notation von XML. BEIDES ist korrekt ("/>" ist eine Abkürzung, die als Endpunkt des XML-Tags dient. Hat also die gleiche Bedeutung wie "</activity>").

@ q-jack:
Probier mal, ob sich was ändert, wenn du die Zeile "Intent myIntent = new Intent(this, TowerDefenseGameActivity.class);" direkt vor "startActivity(myIntent);" packst.
 
Zuletzt bearbeitet:
TheNephilim schrieb:
@ IxSparky:
Nein, der Fehler liegt gewiss nicht bei der Notation von XML. BEIDES ist korrekt ("/>" ist eine Abkürzung, die als Endpunkt des XML-Tags dient. Hat also die gleiche Bedeutung wie "</activity>").

@ q-jack:
Probier mal, ob sich was ändert, wenn du die Zeile "Intent myIntent = new Intent(this, TowerDefenseGameActivity.class);" direkt vor "startActivity(myIntent);" packst.

Genial!
So funktioniert es.
Herzlichen Dank TheNephilim
Jetzt mal aus reinem Interesse, warum lässt Android hier keine globale Variable zu?
 
Du kannst das vermutlich schon als globale Variable deklarieren, Problem wird hier der Context sein, den du schon global definieren willst, wo er noch garnicht existiert. Sprich: du musst die Zuweisung ("myIntent = new Intent(this, TowerDefenseGameActivity.class);") zur Laufzeit machen, da nur zur Laufzeit "this" als Context nicht "null" ist.
 
Ganz einfach weil du zu den Zeitpunkt wo die Variable erstellt wirst die eigentliche Activity noch gar nicht instantiiert hast und somit keinen gültiger Context für das Intent ist

Edit: ach mist zu langsam
 
Zuletzt bearbeitet:
super! Ich sag ja man wird mit der Zeit Codeblind.

Danke für die tolle Hilfe.
Kann geschlossen werden.
 
Hallo,

ich schliese mich hier mal schnell an, da ich ein ähnliches Problem habe.

Ich habe 2 Activitys. Auf meiner MainActivity habe ich einen Button, mit dem ich zur zweiten Activity gelange. Dort befindet sich wieder ein Button, mit dem ich eine Methode aufrufe, die in meiner ZweitenAcitvity.java programmiert ist.

Nun bekomme ich aber den Fehler:

java.lang.IllegalStateException: Could not find a method TestConnection(View) in the activity class gea.plantcontrol.HomeActivity for onClick handler on view class android.widget.Button with id 'buttonTestConnection'

Ich verstehe nicht "... method TestConnection(View) ...HomeActivity" Warum kuckt der nur in der HomeActivity?

mein Manifest:
Code:
[SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]
[LEFT]<[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f7f][SIZE=2][COLOR=#3f7f7f]manifest[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]xmlns:android[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"http://schemas.android.com/apk/res/android"[/LEFT]
[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]package[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"gea.plantcontrol"[/LEFT]
[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:versionCode[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"1"[/LEFT]
[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:versionName[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"1.0"[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]>[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT]
[/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]<[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f7f][SIZE=2][COLOR=#3f7f7f]uses-sdk[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:minSdkVersion[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"16"[/LEFT]
[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:targetSdkVersion[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"15"[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]/>[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT]
[/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]<[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f7f][SIZE=2][COLOR=#3f7f7f]uses-permission[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:name[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"android.permission.INTERNET"[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]/>[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT]
[/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]<[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f7f][SIZE=2][COLOR=#3f7f7f]application[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:icon[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"@drawable/ic_launcher"[/LEFT]
[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:label[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"@string/app_name"[/LEFT]
[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:theme[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"@android:style/Theme"[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]>[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT]



[/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]<[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f7f][SIZE=2][COLOR=#3f7f7f]activity[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:name[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"HomeActivity"[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]>[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]<[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f7f][SIZE=2][COLOR=#3f7f7f]intent-filter[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]>[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]<[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f7f][SIZE=2][COLOR=#3f7f7f]action[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:name[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"android.intent.action.MAIN"[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]/>[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]<[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f7f][SIZE=2][COLOR=#3f7f7f]category[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:name[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"android.intent.category.LAUNCHER"[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]/>[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]</[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f7f][SIZE=2][COLOR=#3f7f7f]intent-filter[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]>[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]</[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f7f][SIZE=2][COLOR=#3f7f7f]activity[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]>[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT]
[/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]<[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f7f][SIZE=2][COLOR=#3f7f7f]activity[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:name[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"ConfigurationActivity"[/LEFT]
[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:label[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"@string/app_name"[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]>[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] 
[/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]</[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f7f][SIZE=2][COLOR=#3f7f7f]activity[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]>[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT]





[/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]</[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f7f][SIZE=2][COLOR=#3f7f7f]application[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]>[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/LEFT]
[/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]</[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f7f][SIZE=2][COLOR=#3f7f7f]manifest[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]>
[/COLOR][/SIZE][/COLOR][/SIZE]

meine zweite Activity:
Code:
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]
[LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] android.app.Activity;[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] android.os.AsyncTask;[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] android.os.Bundle;[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [U]android.view.Menu[/U];[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] android.view.View;[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [U]android.view.View.OnClickListener[/U];[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [U]android.widget.Button[/U];[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] android.widget.EditText;[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [U]android.widget.TextView[/U];
[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]public[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]class[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] ConfigurationActivity [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]extends[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Activity {


[/SIZE][SIZE=2][COLOR=#646464][SIZE=2][COLOR=#646464]@Override[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] onCreate(Bundle savedInstanceState) {
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]super[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].onCreate(savedInstanceState);
setContentView(R.layout.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]activity_configuration[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);

}

[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] TestConnection(View view) {

[/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// Creat AsyncTask to read data[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT]GEATestConnection gtc = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] GEATestConnection();
gtc.execute();
[/LEFT]
}
[/SIZE]

Bin für jede Hilfe Dankbar.
Gruß Flo
 
Zurück
Oben Unten