Switch between views in Android
- by ZelluX
Hi, all
I'm writing an Android application with multiple Tabs. The content of each tabs is determined by XMLs on the Internet, and it could be WebView for HTML rendering, GridView for photo displaying, etc.
I'm going to delay downloading of those XML until the tab is clicked. Upon clicking the application will download corresponding XML from the Internet, and then choose suitable View for it. Currently I have written a MyViewDelegate and use TabSpec.setContent() to set the spec pointing to MyViewDelegate:
spec = tabHost.newTabSpec(tabName[i]);
intent = new Intent().setClass(this, HomeActivity.class);
spec.setIndicator(title[i]);
spec.setContent(new MyViewDelegate(this, tabName[i]));
tabHost.addTab(spec);
My problem is, after MyViewDelegate is required to draw, how can I switch to WebView/GridView and initialize it?
Many thanks.