Android returns from browser to application

I have an option in my application to launch the browser and load the imdb site. I am using ActionView for this.

Intent intent1 = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(website)); try { activity.startActivity(intent1); } catch (Exception e) { Toast.makeText(activity, R.string.no_imdb, Toast.LENGTH_SHORT) .show(); } 

The problem occurs when I click the back button. When the default browser application is launched, everything is in order. When the Opera Mini application is launched, when I click the "Back" button, it seems that my application receives two reverse actions and ends the current activity.

How to prevent this?

+4
source share
1 answer

Try running the intent in a new task:

 intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 

Or

 intent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
+6
source

Source: https://habr.com/ru/post/1447727/


All Articles