Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to close browser tab in android programmatically?

I have an app which plays music from a local server and opens music player in the web browser but when the user goes back to the Home activity and launches Another activity which plays a video on the browser, The video opens in a different tab of the browser, while music tab does not get closed.

Can I close an already opened browser tab when another tab opens? If not. Please suggest some workarounds.

like image 555
MR. Kumar Avatar asked Apr 23 '26 10:04

MR. Kumar


1 Answers

You can't control another applications life-cycle . so you can't close tabs that are running in the browser.

what you can do on the other hand is to use WebView to open the audio/video then you have full control over it (what and when) to load/close content.

like image 102
Mr.Me Avatar answered Apr 24 '26 23:04

Mr.Me