Top "Android-lifecycle" questions

Questions regarding the events forwarded by the system to components, during their lifetime, in an Android Application.

How to start new activity on button click

In an Android application, how do you start a new activity (GUI) when a button in another activity is clicked, …

android android-intent android-activity android-button android-lifecycle
How to use onResume()?

Can anyone give me an example that uses onResume() in Android? Also, if I want to restart the activity at …

android android-lifecycle onresume
Difference and uses of onCreate(), onCreateView() and onActivityCreated() in fragments

What are the differences between onCreate(), onCreateView(), and onActivityCreated() in fragments and what would they each be used for?

android android-fragments android-lifecycle oncreate fragment-lifecycle
java.lang.IllegalStateException: Fragment not attached to Activity

I am rarely getting this error while making an API call. java.lang.IllegalStateException: Fragment not attached to Activity I …

android android-fragments android-activity android-volley android-lifecycle
On logout, clear Activity history stack, preventing "back" button from opening logged-in-only Activities

All activities in my application require a user to be logged-in to view. Users can log out from almost any …

android android-lifecycle activity-lifecycle
IllegalStateException: Fragment already added in the tabhost fragment

FATAL EXCEPTION: main Process: com.example.loan, PID: 24169 java.lang.IllegalStateException: Fragment already added: FormFragment{428f10c8 #1 id=0x7f050055 …

android android-fragments tabs android-lifecycle fragment-tab-host
How do I prevent Android taking a screenshot when my app goes to the background?

The app I'm currently building has the requirement that the app has to prevent the OS to take a screenshot …

android security android-lifecycle
App restarts rather than resumes

Hopefully someone can help me figure out, if not a solution, at least an explanation for a behaviour. The Problem: …

android android-lifecycle
Android - Performing stop of activity that is not resumed

When I push my app to background, and do some other stuff like whatsapp or sms, onResume it works great. …

android android-activity background android-lifecycle onresume
How to get rid of Incremental annotation processing requested warning?

I have just started using android development and trying to use Room library. Since yesterday I am facing this warning …

android android-room android-lifecycle