Hi, I am implementing a simple app. I need to start an activity based on the state of the Activity. Lets take i am using a button to start the activity. 1. If the activity is not started, I need to start XYZ activity. 2. If the XYZ activity is on focus, then i need to close the activity on the button press. 3. If the XYZ activity is not in focus (like onPause) state then, I need to change the button state.
Can you please help me in the flags that i need to use for starting the intent. Is it possible to get the state of activity before I start that activity?