Reputation: 1490
Here is i wish to do. I want to have multiple webview loading their own page. Those webviews are created in different activies that are resulted from item click on a listview.
Sometimes i want to switch from one webview activity to another.
What i have attempted shows that switching between those activities always called onCreate() method that calls webView.loadUrl(). Therefore, the web page get reloaded everytime i switch.
Anyone have idea to design such activities navigation? The key is how to switch to an existing activity without reloading the webView inside. Thank you for advances
Upvotes: 1
Views: 2000
Reputation: 4196
You can do this with a ViewAnimator. Create your WebViews and add them to the ViewAnimator with (something like)
mViewAnimator.addView(mWebView0, index_0, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
then switch to a particular WebView by index (something like)
mViewAnimator.setDisplayedChild(index_0);
Upvotes: 0
Reputation: 7971
If you create an activity for each webView there is no possibility to do what you describe. this happens since you close each activity and give an "OK" to the GC to collect it and throw all WebView data.
Hope this helps.
Upvotes: 1