У нас вы можете посмотреть бесплатно What is Android Activity & Activity life cycle или скачать в максимальном доступном качестве, видео которое было загружено на ютуб. Для загрузки выберите вариант из формы ниже:
Если кнопки скачивания не
загрузились
НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием видео, пожалуйста напишите в поддержку по адресу внизу
страницы.
Спасибо за использование сервиса ClipSaver.ru
hello everyone! We will learn what is an Activity in android and what's it's lifecycle. So, basically an activity is a single screen in android from which a user can interact with a UI. An application can consist any number of activities, so depending upon our use case we add activities. An activity has It own lifecycle which helps to manage our application and also helps to makes it run smooth and avoid unneeded battery and memory consumptions. ----------------------------------------------------------------------------------------------------------- Activity Lifecycle : 1. onCreate() //entry point //invokes just once //Use it for logic that should happen only once //Activity is not yet visible to user //ex- setup UI, initialise viewModel or observe a liveData 2. onStart() //Activity is visible and in background //invokes multiple times //it get invokes when user opens another activity and then press the back button //user can't interact with it, like: pressing a button or scroll the list //typical usage of this callback is to initialise components that you released during //onStop() function or adjust some resources 3. onResume() //Activity is visible and in foreground //invokes multiple times //user can interact with it in any way, like: pressing a button or scroll the list, etc 4. onPause() //Activity is visible and in background //invokes multiple times //system calls this method when our activity losses the focus, ex user navigates to different activity //first indication that a user leaves activity //typical usage is to pause the operations that are not needed ex animations, //releases unneeded light resources like broadcast receivers, gps sensors or any other resources that you don't need //remember that everything that you released should be initialised again in onResume() function //don't call any heavy load shutdown operations //onPause should be performed under 10ms 5. onStop() //Activity is in memory and not visible to user //use it to release heavy resources or save the user data, database transaction or network calls //get invokes when user navigate to another activity or press the home button //android system can kill the application process from this state in case of low memory 6. onDestroy() //end point //invokes just once in lifecycle //final callback that a activity receives //it happens in two cases :- //1. configuration changes ex- rotation or change the language from the settings //2. activity is finished ex- manually called finish() function from the code or killed by the sytem //you shouldn't rely on this callback, in case of low memory the system can //kill the application process and onDestroy() might not get invoked, better to rely on onStop() function 7. onRestart() //activity is not visible to user //it will be called whenever the Activity comes back from the invisible state //ex - when user opens another activity and then press the back button Thats all guys! Thanks for watching! 😇 ------------------------------------------------------------------------------------------------ Github link for this project :- https://github.com/explorewithnik/Ove... Previous videos link :- • How to install Java JDK on Mac OS