I've put a little app together that has three tabs to show three
different web pages. It does work however I am bit worried I haven't
got enough control over how this whole thing works. When I click a
tab, I get a web page loaded (see code sample below), now when I click
another tab another page loads in another view. When I go back to the
first tab, the whole thing get initilized again and the page loads. Is
there a way how I can control this and keep the underneeth tab's
activity in its current state as long as I want (and say only
"refresh" the page when it changes).
do I need to handle onPause()/onResume() methods for that? How do I
store the state of my activity to avoid re-initializing it every time?
tabs.class:
intent = new Intent().setClass(this, tab_schedule.class);
spec = tabHost.newTabSpec("Schedule").setIndicator("Schedule",
res.getDrawable(R.drawable.tab_icon_schedule)).setContent(
intent);
tabHost.addTab(spec);
the tab_schedule.class does a simple web page load:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.tab_people);
try {
WebView currentView = (WebView)
findViewById(R.id.tab_people_WebView);
currentView.getSettings().setJavaScriptEnabled(true);
currentView.loadUrl("http://pda.lenta.ru");
} catch (Exception e) {
Log.v("webClientInit", e.getMessage());
}
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en