Android Problem mit Zurücktaste und ausgabe der Aktuellen Seite

android_domi

Mitglied
Hallo,
ich bin Momentan dabei eine Andoid App mit mehreren Seiten zu erstellen und möchte wissen wie ich rausbekomme, auf welcher meiner Seiten er sich gerade befindet...sowas wie getContentenView, was es ja leider nicht gibt. Gibt es vlt. sowas wie einen "Umweg" ?? Ich brauche das, damit ich den User auf die rictige Seite zurück bringe wenn er die "Zurück" Taste drückt.

Danke schonmal im Vorraus.
 

anti-held

Bekanntes Mitglied
Normal solltest du für deine verschiedenen View jeweils eigene Activities erstellen.
Diese können sich dann gegenseitig per [c]startActivity[/c] aufrufen.

Da jede Activity eigene Methoden hat, musst du auch nicht Views abfragen, welchen Zustand du gerade hast.

Activities | Android Developers
 

android_domi

Mitglied
Ich bin recht neu bei Android, kann ich Activities noch nachträglich erstellen, also zu jeder seite?

Und das Aufrufen ist nicht mein Problem.
 
Zuletzt bearbeitet:

anti-held

Bekanntes Mitglied
Ich würde dir empfehlen, ein paar Tutorials durchzuarbeiten, bevor du deine erste eigene App schreibst.
Eine Möglichkeit wäre:
Anfänger Workshop

So erstellst du dir dann eine einzelnen "Seiten" als Activities.

Und dann schaust du dir an, wie diese voneinander aufgerufen werden:
Activity starten
 
Zuletzt bearbeitet:

android_domi

Mitglied
Okay, danke aber ich habe bestimmt schon 6 Stunden Turorials geguckt und nichts gefunden darum habe ich hier gefragt..
Kann man Rausbekommen auf welcher Seite der User sich MOmentan befindet, oder nicht?
 

anti-held

Bekanntes Mitglied
Wenn du deine App wie beschrieben mit Activities schreibst, hat jede Activity seine eigenen Methoden für alle Buttons und Anzeigeelemente die auf dieser "Seite" sichtbar sind.

Wenn du eine einzelne Activity erstellst, wie du es erläuterst, müsstest du vill eine Membervariable erstellen, die speichert, welche "Seite" gerade angezeigt ist. Und diese natürlich immer setzen, bevor du setContentView aufrufst.

Weitaus schöner ist natürlich trotzdem die Idee, mehrere Activities zu erstellen.
 

dzim

Top Contributor
Activities würde ich nur verwenden, wenn du eine komplett entkoppelte Oberfläche brauchst (Einstellungen, eine optionale Kartenansicht, ...) Ansonsten verwende lieber Fragments. Die kannst du zum Beispiel in so einen Tab-Container stopfen, um links und rechts zu swipen, oder einen Drawer einzubinden, oder oder oder. Ohne lästiges aufpoppen neuer Fenster. Und der Backbutton geht (wenn man es möchte) auch noch.
ich empfehle immer Lars Vogels Tutorials: Android Development (allg. Übersicht über alle Tutorials aus der Kategorie) -> Multi-pane development in Android with Fragments - Tutorial (spezielles Tutorial für Fragmente, solltest die anderen davor aber schon mal gemacht haben)
 
Ähnliche Java Themen
  Titel Forum Antworten Datum
W Prüfen, ob App auf Gerät installiert ist Problem S10 Android & Cross-Platform Mobile Apps 11
W In App Purchase Problem? Android & Cross-Platform Mobile Apps 36
W Problem mit Android Studio Android & Cross-Platform Mobile Apps 0
T Android R.string.test+i Problem Android & Cross-Platform Mobile Apps 2
K Android to Pi | Websocket Problem Android & Cross-Platform Mobile Apps 3
N Intent und finish() Problem Android & Cross-Platform Mobile Apps 5
B Android App Programmierung Einsteiger Problem Android & Cross-Platform Mobile Apps 4
emeraldo Android Problem mit Bottomnavmenu Android & Cross-Platform Mobile Apps 10
I Das Problem mit der Tastatur... android:windowSoftInputMode="adjustPan" Android & Cross-Platform Mobile Apps 1
M Android App → Problem mit dem Speichern von einem Bitmap–Objekt. Android & Cross-Platform Mobile Apps 1
A Android Android Studio Emulator Problem Android & Cross-Platform Mobile Apps 1
S Android Studio Bluetooth App Problem Android & Cross-Platform Mobile Apps 6
J TicTacToe Problem bei kontrolle Android & Cross-Platform Mobile Apps 7
J Button array ID Problem Android & Cross-Platform Mobile Apps 2
M Problem bei Werteübergabe, MSQL verbindung Android & Cross-Platform Mobile Apps 3
S Android Problem mit Android Virtual Device erstellung. Android & Cross-Platform Mobile Apps 2
Anfänger2011 Text to Speech Problem Android & Cross-Platform Mobile Apps 1
S Android Android java onclick listener Problem Android & Cross-Platform Mobile Apps 9
A Android Problem mit ListView und OnItemClickListener.. Android & Cross-Platform Mobile Apps 10
K Problem mit arraylist und button Android & Cross-Platform Mobile Apps 16
R W-Lan Problem über Sockets Android & Cross-Platform Mobile Apps 1
P ViewPager Problem Android & Cross-Platform Mobile Apps 1
A Android Problem mit Video von Youtube abspielen Android & Cross-Platform Mobile Apps 4
B Android Problem mit Soundwiedergabe Android & Cross-Platform Mobile Apps 2
T Android Android Sensor: Java Problem Android & Cross-Platform Mobile Apps 1
G Problem beim Rendern von 3D-Objekt Android & Cross-Platform Mobile Apps 0
L Android Gyroscope Sensor Problem Android & Cross-Platform Mobile Apps 2
S Android GPS Problem Android & Cross-Platform Mobile Apps 24
J Eclipse Emulator Problem Android & Cross-Platform Mobile Apps 1
J Eclipse Emulator Problem Android & Cross-Platform Mobile Apps 0
B Android Problem mit Rückgabewert Android & Cross-Platform Mobile Apps 13
L Android komisches Bitmap-Größe-Problem Android & Cross-Platform Mobile Apps 8
D Android Layout Problem Android & Cross-Platform Mobile Apps 2
R Problem mit View in ScrollView Android & Cross-Platform Mobile Apps 6
R Eclipse + AndroidSDK - Problem mit Referenzen Android & Cross-Platform Mobile Apps 6
M Problem mit setOnClickListener Android & Cross-Platform Mobile Apps 4
DaniSahne96 Problem beim Appdebuggen auf Smartphone Android & Cross-Platform Mobile Apps 3
P Android Problem beim Widget - Denkfehler ? Android & Cross-Platform Mobile Apps 2
M GCM IntentService Problem Android & Cross-Platform Mobile Apps 3
D Android Gallery Problem Android & Cross-Platform Mobile Apps 5
P Problem mit Cell id Android & Cross-Platform Mobile Apps 6
L Android Problem mit "spinner" Android & Cross-Platform Mobile Apps 10
D Android problem mit geschwindigkeitsberechnung app Android & Cross-Platform Mobile Apps 2
E Android Problem mit Contact Provider Android & Cross-Platform Mobile Apps 1
H Android Problem mit ListActivity Android & Cross-Platform Mobile Apps 3
S Android Layout Problem mit fill_parent Android & Cross-Platform Mobile Apps 5
F Android ExpandableList, SimpleCursorTreeAdapter, Cursor Problem Android & Cross-Platform Mobile Apps 2
A Android Problem mit Long.getLong() bzw. Integer.getInteger() Android & Cross-Platform Mobile Apps 2
A Problem mit HTTP- Verbindung Android & Cross-Platform Mobile Apps 4
V [Java] und [JavaME] ClientServer StreamConnection . Problem beim lesen / schreiben Android & Cross-Platform Mobile Apps 2
F Eclipse JAD File erzeugen -- Problem Android & Cross-Platform Mobile Apps 10
R Ein Problem beim ausführen von folgendem Quelltext Android & Cross-Platform Mobile Apps 11
M Problem mit dem Auslesen von System Properties Android & Cross-Platform Mobile Apps 7
P wtk problem Android & Cross-Platform Mobile Apps 3
G Math exp() Problem Android & Cross-Platform Mobile Apps 4
G S40 Problem Android & Cross-Platform Mobile Apps 8
A Problem beim Subtrahieren eines Double von einem Double Android & Cross-Platform Mobile Apps 5
C Problem Device/Emulator wird nicht erkannt Android & Cross-Platform Mobile Apps 3
S Image Problem Android & Cross-Platform Mobile Apps 11
M Problem mit den Softkeys Android & Cross-Platform Mobile Apps 4
G J2ME jar-problem Android & Cross-Platform Mobile Apps 10
S Komisches Problem Android & Cross-Platform Mobile Apps 3
F Problem beim Erstellen der Jar File Android & Cross-Platform Mobile Apps 4
A Problem: Canvas-Grösse Motorola RAZR v3r Android & Cross-Platform Mobile Apps 8
S Problem mit Einbindung einer externer Bibliothek Android & Cross-Platform Mobile Apps 2
G Random - Problem Android & Cross-Platform Mobile Apps 5
E problem mit den resourcen Android & Cross-Platform Mobile Apps 2
O Problem mit Datagramconnection Android & Cross-Platform Mobile Apps 2
P Problem mit der Uhrzeit Android & Cross-Platform Mobile Apps 2
S Problem auf dem Handy Android & Cross-Platform Mobile Apps 3
W ListView OnItemClicklistener setzen mit Ausgabe Android & Cross-Platform Mobile Apps 35
B Falsche ausgabe einer Rechnung! Android & Cross-Platform Mobile Apps 8
W Gezielte Ausgabe von abgefragten Inhalt aus Datenbank Android & Cross-Platform Mobile Apps 1
G Unterschiedliche Ausgabe in Emulator und auf Smartphone Android & Cross-Platform Mobile Apps 2
P Zaehler Ausgabe Android & Cross-Platform Mobile Apps 12

Ähnliche Java Themen

Neue Themen


Oben