I have a BrowserActivity that is pretty much a container for a WebView and it’s reachable with the use of intent-filter and android.intent.action.VIEW
. In other words, links can be opened directly inside my app.
Then after the pages finishes loading I perform some work on the html source.
Everything works as expected but anytime the user click on a new link, a new activity is created on top of the previous one.
For this reason I have added into the manifest to my activity
android:launchMode="singleTask"
or
android:launchMode="singleTop"
If I use one of these two attributes even though I prevent my activity to be created on top of the previous one, sadly the work is done only on the first opened link.
All links opened after the first one even though they automatically open the activity nothing happens.