简体   繁体   中英

How to bring webview in android to front?

I have an android application in which upon clicking “netbank icon” I am launching a webview with URL loaded in it, with the help of method webview.loadUrl(). When I press hard key back on the device it goes to the previous screen.

Now I am on the screen which has “netbank icon”. Upon clicking this icon I want to show the previous webview again without loading new url. I just want to bring that webview to front. What is the way out for that?

I have tried webview.bringtofront() but it only show a blank screen.

if the webview is being loaded in a new activity, then when you press the hard back button basically, onDestroy() of that activity is called, which means activity no more exists and when u again click the icon the activity is created once again....hence you cannot get the same web view state when you once go back and then come again...

you may find something of your interest here: http://developer.android.com/reference/android/webkit/WebView.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM