100% de satisfacción garantizada Inmediatamente disponible después del pago Tanto en línea como en PDF No estas atado a nada 4.2 TrustPilot
logo-home
Resumen

Summary Activity Lifecycle: CSC2002S Mobile Design and Development Module (MDD)

Puntuación
-
Vendido
-
Páginas
2
Subido en
17-10-2022
Escrito en
2022/2023

These notes cover the sections: Android, activity lifecycle, design principles, evaluation, everyday design, views, widgets, layouts, security, software architecture, understanding users and ideas, prototypes, products. These are all the topics you need to ace the MDD section of the exam, which is 33.3% of the paper.

Mostrar más Leer menos
Institución
Grado








Ups! No podemos cargar tu documento ahora. Inténtalo de nuevo o contacta con soporte.

Escuela, estudio y materia

Institución
Grado

Información del documento

Subido en
17 de octubre de 2022
Número de páginas
2
Escrito en
2022/2023
Tipo
Resumen

Temas

Vista previa del contenido

// set the user interface layout for this activity
// the layout file is defined in the project res/layout/main_activity.xml file setContentView(R.layout.main_activity)
// initialize member TextView so we can manipulate it later
Activity Lifecycle
textView = findViewById(R.id.text_view)
}
// This callback is called only when there is a saved instance that is previously saved by using onSaveInstanceState().
→ The different states (that your application can move through) and callbacks helps the OS to manage resources and // We restore some state in onCreate(), while we can optionally restore other state here, possibly usable after onStart() has complete
// The savedInstanceState Bundle is same as the one used in onCreate().
application interrupts.
override fun onRestoreInstanceState(savedInstanceState: Bundle?) {
**KNOW & UNDERSTAND THESE STATES
textView.text = savedInstanceState?.getString(TEXT_VIEW_KEY)
}
** REFER TO SLIDES FOR EXAMPLES:
// invoked when the activity may be temporarily destroyed, save the instance state here
override fun onSaveInstanceState(outState: Bundle?) {
outState?.run {
https://s3-us-west-2.amazonaws.com/secure.notion-static.com/33dd8baf-86f3-4d89-bad4-7e08dae67ae2/MDD07-activit putString(GAME_STATE_KEY, gameState) putString(TEXT_VIEW_KEY, textView.text.toString())
ies.pdf }
// call superclass to save any view hierarchy
super.onSaveInstanceState(outState)
}
→ Extend the base activity class
→ Override functions
→ Only implement functions that you need
→ Call the super class method
→ Pay attention to what you re building and destroying
→ What part of the lifecycle is the app currently in?
Activity lifecycle methods are called automatically depending on
the OS needs and the stage they are in.
Initiate the UI in onCreate() User Navigation
Use onSaveInstanceState() and onRestoreInstanceState() to Handle Home and Back buttons gracefully
preserve state
It’s important to distinguish between the navigation buttons
Most users don’t know the difference – be gracious!
Interruptions: Lifecycle management is especially important
due to resource management constraints Home button
Calls onStop(), onStart()
The app is stopped but not destroyed
Implementing Activities
Back button
The Activity Class
Goes back to previous activity (unless you’ve overridden this)
Calls onStop(), onDestroy()
lateinit var textView: TextView
// some transient state for the activity instance Important when implementing multiple Activities (data retention)
var gameState: String? = null
override fun onCreate(savedInstanceState: Bundle?) {
// call the super class onCreate to complete the creation of activity like // the view hierarchy Screen Rotation
super.onCreate(savedInstanceState)
→ Your Activity will be destroyed and recreated each time the screen rotates. Needs to re-render & re-build the screen
// recovering the instance state based on the new screen layout.
gameState = savedInstanceState?.getString(GAME_STATE_KEY)
Activity Lifecycle 1 Activity Lifecycle 2
$3.11
Accede al documento completo:

100% de satisfacción garantizada
Inmediatamente disponible después del pago
Tanto en línea como en PDF
No estas atado a nada


Documento también disponible en un lote

Conoce al vendedor

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
chloewalt University of Cape Town
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
24
Miembro desde
3 año
Número de seguidores
12
Documentos
36
Última venta
1 mes hace

4.8

6 reseñas

5
5
4
1
3
0
2
0
1
0

Recientemente visto por ti

Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes