Arveen
Arveen

Reputation: 868

How to replace the entire layout with a webview

I have a Edittext, a button and a ListView in my activity. Now when any of the options on listview are selected i want to replace everything by a webview and if the user presses back i want to come back to the original view. How do i do this? I looked at View flipper but that is mostly used if you switch between views a lot, also is it a good idea to use webview with viewflipper.

Upvotes: 0

Views: 97

Answers (2)

Kenny
Kenny

Reputation: 5542

You could use the visiblity of the views, so setup a webview that fills the screen then set its visibility to gone in your xml, then when you want to display it use myView.setVisibility(View.VISIBLE); in your code to display the webview, it would probable be a good idead to make your buttons etc invisible using myView.setVisibility(View.GONE);

It would however be easier just to setup another activity with your webview in and just start that activity when required.

Upvotes: 1

Rocker
Rocker

Reputation: 681

In view method of item Listener of your code do something like this...

Intent intent = new Intent(android.content.Intent.ACTION_VIEW,Uri.parse("Web link here"));

and you are done with it...

Or please post your code so I can help you in better manner...

Upvotes: 0

Related Questions