Switch between views in Android

Posted by ZelluX on Stack Overflow See other posts from Stack Overflow or by ZelluX
Published on 2010-05-18T05:13:12Z Indexed on 2010/05/18 5:21 UTC
Read the original article Hit count: 329

Filed under:
|

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.

© Stack Overflow or respective owner

Related posts about android

Related posts about tabhost