how can i return to my application after reading news in google chrome?

I am a bit new to programming and I have been trying to do some things in Android Studio, I wanted to ask if anyone knows how I can get back to my application after executing an implicit Intent (which has the function of sending me from my application to the Google Chrome browser to read news). The idea is to go from the app to the browser and then when I press the back button return to my application, not close everything and return to the main screen of the phone (I attach a gif that I recorded in case you understand better what I want to do, in addition to the code of the implicit Intent Intent)

Gif:

https://i.ibb.co/gMPJY0K/gif-noticia-volver-AApp.gif

Implicit Intent Code:

 binding.ivImagenDetalle.setOnClickListener(View.OnClickListener {
    
     val webIntent: Intent = Uri.parse("${noticia.url}").let { webpage ->
     Intent(Intent.ACTION_VIEW, webpage)

 }

startActivity(webIntent)

})

I have read some methods but "startActivityForResult" and other are deprecated. Also say that I am using Android Navigation Components and I have reviewed about PopUpTo & PopUpToInclusive, but I still don’t fully understand it or know how to use it. Most of what I reviewed in is in Java, but I think I can understand it, although in the end I would have to write to Kotlin.

That´s all, English is not my native language, so I apologize for possible writing errors. Thank you

Source: Android Studio Questions

LEAVE A COMMENT