Android Training/Managing the Activity Lifecycle: Unterschied zwischen den Versionen

Aus Android Wiki
Keine Bearbeitungszusammenfassung
(Diese Seite wurde zum Übersetzen freigegeben)
 
Zeile 1: Zeile 1:
<languages />
<languages />
<translate>
<translate>
<!--T:1-->
As a user navigates through, out of, and back to your app, the <code>[http://developer.android.com/reference/android/app/Activity.html Activity]</code> instances in your app transition between different states in their lifecycle. For instance, when your activity starts for the first time, it comes to the foreground of the system and receives user focus. During this process, the Android system calls a series of lifecycle methods on the activity in which you set up the user interface and other components. If the user performs an action that starts another activity or switches to another app, the system calls another set of lifecycle methods on your activity as it moves into the background (where the activity is no longer visible, but the instance and its state remains intact).
As a user navigates through, out of, and back to your app, the <code>[http://developer.android.com/reference/android/app/Activity.html Activity]</code> instances in your app transition between different states in their lifecycle. For instance, when your activity starts for the first time, it comes to the foreground of the system and receives user focus. During this process, the Android system calls a series of lifecycle methods on the activity in which you set up the user interface and other components. If the user performs an action that starts another activity or switches to another app, the system calls another set of lifecycle methods on your activity as it moves into the background (where the activity is no longer visible, but the instance and its state remains intact).


<!--T:2-->
Within the lifecycle callback methods, you can declare how your activity behaves when the user leaves and re-enters the activity. 
Within the lifecycle callback methods, you can declare how your activity behaves when the user leaves and re-enters the activity. 


<!--T:3-->
For example, if you're building a streaming video player, you might pause the video and terminate the network connection when the user switches to another app. When the user returns, you can reconnect to the network and allow the user to resume the video from the same spot.
For example, if you're building a streaming video player, you might pause the video and terminate the network connection when the user switches to another app. When the user returns, you can reconnect to the network and allow the user to resume the video from the same spot.


<!--T:4-->
This class explains important lifecycle callback methods that each <code>Activity</code> instance receives and how you can use them so your activity does what the user expects and does not consume system resources when your activity doesn't need them.
This class explains important lifecycle callback methods that each <code>Activity</code> instance receives and how you can use them so your activity does what the user expects and does not consume system resources when your activity doesn't need them.


== Lessons ==
== Lessons == <!--T:5-->
</translate>
</translate>
; '''[[Spezial:Meine Sprache/Android Training/Starting an Activity|<translate>Starting an Activity</translate>]]'''
; '''[[Spezial:Meine Sprache/Android Training/Starting an Activity|<translate><!--T:6-->
: <translate>Learn the basics about the activity lifecycle, how the user can launch your app, and how to perform basic activity creation.</translate>
Starting an Activity</translate>]]'''
: <translate><!--T:7-->
Learn the basics about the activity lifecycle, how the user can launch your app, and how to perform basic activity creation.</translate>


; '''[[Spezial:Meine Sprache/Android Training/Pausing and Resuming an Activity|<translate>Pausing and Resuming an Activity</translate>]]'''
; '''[[Spezial:Meine Sprache/Android Training/Pausing and Resuming an Activity|<translate><!--T:8-->
: <translate>Learn what happens when your activity is paused (partially obscured) and resumed and what you should do during these state changes.</translate>
Pausing and Resuming an Activity</translate>]]'''
: <translate><!--T:9-->
Learn what happens when your activity is paused (partially obscured) and resumed and what you should do during these state changes.</translate>


; '''[[Spezial:Meine Sprache/Android Training/Stopping and Restarting an Activity|<translate>Stopping and Restarting an Activity</translate>]]'''
; '''[[Spezial:Meine Sprache/Android Training/Stopping and Restarting an Activity|<translate><!--T:10-->
: <translate>Learn what happens when the user completely leaves your activity and returns to it.</translate>
Stopping and Restarting an Activity</translate>]]'''
: <translate><!--T:11-->
Learn what happens when the user completely leaves your activity and returns to it.</translate>


; '''[[Spezial:Meine Sprache/Android Training/Recreating an Activity|<translate>Recreating an Activity</translate>]]'''
; '''[[Spezial:Meine Sprache/Android Training/Recreating an Activity|<translate><!--T:12-->
: <translate>Learn what happens when your activity is destroyed and how you can rebuild the activity state when necessary.</translate>
Recreating an Activity</translate>]]'''
: <translate><!--T:13-->
Learn what happens when your activity is destroyed and how you can rebuild the activity state when necessary.</translate>


{{TNT|Android Training/Attribution}}
{{TNT|Android Training/Attribution}}
[[Kategorie:Android Training]]
[[Kategorie:Android Training]]

Aktuelle Version vom 9. Februar 2016, 19:59 Uhr

Sprachen:

As a user navigates through, out of, and back to your app, the Activity instances in your app transition between different states in their lifecycle. For instance, when your activity starts for the first time, it comes to the foreground of the system and receives user focus. During this process, the Android system calls a series of lifecycle methods on the activity in which you set up the user interface and other components. If the user performs an action that starts another activity or switches to another app, the system calls another set of lifecycle methods on your activity as it moves into the background (where the activity is no longer visible, but the instance and its state remains intact).

Within the lifecycle callback methods, you can declare how your activity behaves when the user leaves and re-enters the activity. 

For example, if you're building a streaming video player, you might pause the video and terminate the network connection when the user switches to another app. When the user returns, you can reconnect to the network and allow the user to resume the video from the same spot.

This class explains important lifecycle callback methods that each Activity instance receives and how you can use them so your activity does what the user expects and does not consume system resources when your activity doesn't need them.

Lessons[Bearbeiten | Quelltext bearbeiten]

Starting an Activity
Learn the basics about the activity lifecycle, how the user can launch your app, and how to perform basic activity creation.
Pausing and Resuming an Activity
Learn what happens when your activity is paused (partially obscured) and resumed and what you should do during these state changes.
Stopping and Restarting an Activity
Learn what happens when the user completely leaves your activity and returns to it.
Recreating an Activity
Learn what happens when your activity is destroyed and how you can rebuild the activity state when necessary.