Issue with tabs

Put your problem here if it does not fit any of the other categories.

Issue with tabs

Postby confused » Sat Nov 08, 2008 11:32 pm

I'm making an irc application and now I've run into a problem. I am using Tabs to represent the channels I join but the content for each tab stays the same.

For example, I have a Status tab and then another for channel #foo. When I do /join #foo, Status becomes empty and it's content is shown is #foo until I click on foo and then on status again. After this, both tabs stay the same content wise.

Right now, I need to find a way to update #foo without affecting Status and also a way to close a tab.

I have a single XML file which holds a common layout for all tabs, my tabs are generated like this:

Code: Select all
     tabHost = getTabHost();
      LayoutInflater.from(this).inflate(R.layout.tabs, tabHost.getTabContentView(), true);

      tabHost.addTab(tabHost.newTabSpec("Tab Name")
             .setIndicator("Status")
             .setContent(R.id.default_layout));


and my layout is like this:

Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
   android:id="@+id/rl"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   xmlns:android="http://schemas.android.com/apk/res/android"
   >
   <EditText
       android:id="@+id/et"
       android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:layout_alignParentBottom="true"
      
   />
   <ScrollView
      android:id="@+id/sv2"
      android:layout_width="wrap_content"
      android:layout_height="fill_parent"
      android:layout_alignParentTop="true"
      android:layout_alignParentRight="true"
      android:layout_above="@id/et"
   >
   <TableLayout
      android:id="@+id/tl"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:padding="10px"
      >
         <TableRow>
        <TextView
            android:text="23"
            android:padding="3dip" />
            </TableRow>   
            <TableRow>
      <!--tablerow is used for the user list -->
    </TableLayout>
    </ScrollView>
   <ScrollView   
      android:id="@+id/sv"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:layout_alignParentTop="true"
      android:layout_alignParentLeft="true"
      android:layout_alignParentRight="false"
      android:layout_toLeftOf="@id/sv2"
      android:layout_above="@id/et"
      >
      <TextView
      android:id="@+id/tv"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:autoLink="web|email|phone"
      android:textSize="12px"

   >
   </TextView>
   </ScrollView>

</RelativeLayout>

If anyone has any ideas for this problem, or an alternative to using tabs, I'd be grateful for the input.


Thanks.
confused
Junior Developer
Junior Developer
 
Posts: 16
Joined: Fri Oct 03, 2008 2:30 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot] and 11 guests