Skip to content

Latest commit

 

History

History
29 lines (17 loc) · 1.54 KB

401-27.md

File metadata and controls

29 lines (17 loc) · 1.54 KB
layout title permalink
page
401.27 Reading Notes
/401-R27/

Intents, Activities, and SharedPreferences

The Back Stack

  • A series of activities form a back stack based on the order in which activities were opened. The back stack is popped when Back is triggered on the system. Resuming an app will restore the existing back stack, while a freshly started or oldest activity in the stack will Back into the system Home screen.

  • the onBackPressed() method can be overridden to adjust behavior for background "warm" state instead of termination.

  • The same activity may be present multiple times in the back stack for each instance if the app's structure allowed for this sequence.

Background Tasks

  • Multiple apps may be runnning in the background simultaneously. When in the background, the system selectively ends these background activities to free up memory.

Task Management

  • The default activity behaviors may be altered or interrupted with attributes for the <activity> element as well as flags for an intent (when transitioning from one activity to another).

  • New activities begin either from a defined manifest behavior (in the launchMode attribute) or the startActivity() method and the associated Intent (when the two interact, an intent superscedes a manifest)

Shared Preferences

  • The methods getSharedPreferences() and getPreferences() are used for file access that is available across your app or for a particular activity, respectively. getPreferences() does not require that a file name be specified.