Tab and sub Activities..

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Tab and sub Activities..

Postby williamzanelli » Sun Apr 19, 2009 7:02 pm

Hi guys,

I have a TabHost, which has 4 Tabs inside it.

Code: Select all
host.addTab(host.newTabSpec("one") 
                                    .setIndicator("One") 
                                    .setContent(new Intent(this, dataClassOne.class))); 
                    host.addTab(host.newTabSpec("two") 


dataClassOne.class, adds a lits of data, in ListView - the View Class looks like

Code: Select all
<TextView 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text=""
    android:id="@+id/date"
    />
<ListView
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   android:id="@+id/itemlist"
   
   />
   <TextView 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text=""
    android:id="@+id/random1"
    />   
       <TextView 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text=""
    android:id="@+id/random2"
    />



When someone clicks the itm in the list, it fires of an startActivityForResult (myIntent_, which dispalys some text - *I want the tab headings to stay, whilst the tab content view changes,* it doesnt

Any ideas on how I can achieve this - ??


Thanks for your thoughts in advance

Will
Will
williamzanelli
Experienced Developer
Experienced Developer
 
Posts: 63
Joined: Mon Jan 05, 2009 2:37 am
Location: UK

Top

use setContentView() in onCreate()

Postby satishkumar_lskin » Fri Apr 24, 2009 3:15 pm

In onCreate() of dataClassOne Activity , use setContentView(yourView);
Then , if u want to continuously change "yourView" on some UI event , then use "yourView.addView()" method specifying the index , say for example 0 ( zero) . This way, the tab content alone changes and the header remains.
satishkumar_lskin
Developer
Developer
 
Posts: 32
Joined: Mon Oct 20, 2008 8:15 am
Location: Coimbatore , TamilNadu, India

Postby williamzanelli » Fri Apr 24, 2009 4:30 pm

Thanks for the reply Satish, I'll look into it.

Do you have any example code?

Thanks
Will
williamzanelli
Experienced Developer
Experienced Developer
 
Posts: 63
Joined: Mon Jan 05, 2009 2:37 am
Location: UK

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 6 guests