WEB开发网
开发学院手机开发Android 开发 Android 开基础 Calling into the superclass 阅读

Android 开基础 Calling into the superclass

 2010-07-15 21:17:00 来源:WEB开发网   
核心提示:onCreate() and then stop the thread in onDestroy().The visible lifetime of an activity happens between a call to onStart() until a corresponding call to onStop(
onCreate() and then stop the thread in onDestroy().

The visible lifetime of an activity happens between a call to onStart() until a corresponding call to onStop(). During this time, the user can see the activity on-screen, though it may not be in the foreground and interacting with the user. Between these two methods, you can maintain resources that are needed to show the activity to the user. For example, you can register a BroadcastReceiver in onStart() to monitor for changes that impact your UI, and unregister it in onStop() when the user can no longer see what you are displaying. The onStart() and onStop() methods can be called multiple times, as the activity alternates between being visible and hidden to the user.

The foreground lifetime of an activity happens between a call to onResume() until a corresponding call to onPause(). During this time, the activity is in front of all other activities on screen and is interacting with the user. An activity can frequently transition between the resumed and paused states — for example, onPause() is called when the device goes to sleep or when a new activity is started, onResume() is called when an activity result or a new intent is delivered. Therefore, the code in these two methods should be fairly lightweight.

上一页  1 2 

Tags:Android 基础 Calling

编辑录入:coldstar [复制链接] [打 印]
赞助商链接