On Mon, Aug 2, 2010 at 4:56 PM, guich <guiha...@gmail.com> wrote: > I'm trying to do a fairly simple thing but i'm failing since 3 hours. > > I have a WebView that i show with some pictures and html stored in > local sdcard. After the user clicks a button in my app, i want to show > the webview, and when he press the back button, i want to return to > the previous view (which is my main app view). > > Can someone tell me how to do it? I tried this: > > WebView webview = new WebView(this); > setContentView(webview); > webview.loadUrl(url); > > However, when i press back, my app quits.
Of course. That's what it is supposed to do. You eradicated your "previous view" and replaced it outright with the WebView. BACK will exit your activity as normal. Either start up a new activity to show the Web content, or use an AlertDialog with a WebView content, or plan on another ~100 lines of code to pop up a WebView, handle the BACK button to dismiss the WebView, and so on. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _Android Programming Tutorials_ Version 2.9 Available! -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en