I have an activity that loads some content using an AsyncTask.
If the content is null then i launch an activty that contains a WebView to load the data.
The only problem is when i launch the activity using regular intents.
When the back button is pressed to return out of the WebView.
It returns to the following activity and the AsyncTask is ran again, and it does the same thing all over again.
I know how to Override the onBackPressed button. But what should i do to override this from happening each time?
If the content is null then when you launch the second Activity (with the WebView) you should call
finish()on the first Activity.EDIT: Alternatively you should use
startActivityForResultand then in theonActivityResultmethod invokefinish().