Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - version rc37a is showing only one tab

version rc37a is showing only one tab

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

version rc37a is showing only one tab

Postby rock_win » Sat Mar 15, 2008 11:12 am

After reading the posts posted to using multiple tabs, i tried it in m37,but even after adding 4 TabWidgets only the last one is shown and is the only tab.

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2.  
  3. <TabHost xmlns:android="http://schemas.android.com/apk/res/android"
  4.  
  5.         id="@android:id/tabhost"
  6.  
  7.         android:layout_width="fill_parent"
  8.  
  9.         android:layout_height="fill_parent">
  10.  
  11.         <TabWidget id="@android:id/tabs" android:layout_width="fill_parent"
  12.  
  13.                 android:layout_height="wrap_content" android:background="#f00">
  14.  
  15.  
  16.  
  17.                 <FrameLayout id="@android:id/tabcontent" android:layout_width="fill_parent"
  18.  
  19.                         android:layout_height="wrap_content" android:background="#f08">
  20.  
  21.                         <TextView android:layout_width="fill_parent"
  22.  
  23.                                 android:layout_height="wrap_content"
  24.  
  25.                                 android:text="Hello World, TabView1" />
  26.  
  27.                 </FrameLayout>
  28.  
  29.         </TabWidget>
  30.  
  31.         <TabWidget id="@android:id/tabs" android:layout_width="fill_parent"
  32.  
  33.                 android:layout_height="wrap_content" android:background="#0f0">
  34.  
  35.  
  36.  
  37.                 <FrameLayout id="@android:id/tabcontent" android:layout_width="fill_parent"
  38.  
  39.                         android:layout_height="wrap_content" android:background="#f80">
  40.  
  41.                         <TextView android:layout_width="fill_parent"
  42.  
  43.                                 android:layout_height="100px"
  44.  
  45.                                 android:text="Hello World, TabView2" />
  46.  
  47.                 </FrameLayout>
  48.  
  49.         </TabWidget>
  50.  
  51.         <TabWidget id="@android:id/tabs" android:layout_width="fill_parent"
  52.  
  53.                 android:layout_height="wrap_content" android:background="#00f">
  54.  
  55.  
  56.  
  57.                 <FrameLayout id="@android:id/tabcontent" android:layout_width="fill_parent"
  58.  
  59.                         android:layout_height="wrap_content" android:background="#a08">
  60.  
  61.                         <TextView android:layout_width="fill_parent"
  62.  
  63.                                 android:layout_height="100px"
  64.  
  65.                                 android:text="Hello World, TabView3" />
  66.  
  67.                 </FrameLayout>         
  68.  
  69.  
  70.  
  71.         </TabWidget>
  72.  
  73.         <TabWidget id="@android:id/tabs" android:layout_width="fill_parent"
  74.  
  75.                 android:layout_height="wrap_content" android:background="#a0f">
  76.  
  77.  
  78.  
  79.                 <FrameLayout id="@android:id/tabcontent" android:layout_width="fill_parent"
  80.  
  81.                         android:layout_height="wrap_content" android:background="#a08">
  82.  
  83.                         <TextView android:layout_width="fill_parent"
  84.  
  85.                                 android:layout_height="100px"
  86.  
  87.                                 android:text="Hello World, TabView3" />
  88.  
  89.                 </FrameLayout>         
  90.  
  91.  
  92.  
  93.         </TabWidget>
  94.  
  95.         <TabWidget id="@android:id/tabs" android:layout_width="fill_parent"
  96.  
  97.                 android:layout_height="wrap_content" android:background="#fff">
  98.  
  99.  
  100.  
  101.                 <FrameLayout id="@android:id/tabcontent" android:layout_width="fill_parent"
  102.  
  103.                         android:layout_height="wrap_content" android:background="#a08">
  104.  
  105.                         <TextView android:layout_width="fill_parent"
  106.  
  107.                                 android:layout_height="100px"
  108.  
  109.                                 android:text="Hello World, TabView4" />
  110.  
  111.                 </FrameLayout>         
  112.  
  113.  
  114.  
  115.         </TabWidget>
  116.  
  117.         <!-- TextView  
  118.  
  119.                 android:layout_width="fill_parent"
  120.  
  121.                 android:layout_height="wrap_content"
  122.  
  123.                 android:text="Hello World, TabView"
  124.  
  125.                 /-->
  126.  
  127. </TabHost>
  128.  
  129.  
Parsed in 0.004 seconds, using GeSHi 1.0.8.4


Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. package com.tbv;
  2.  
  3.  
  4.  
  5. import android.app.Activity;
  6.  
  7. import android.os.Bundle;
  8.  
  9. import android.widget.TabHost;
  10.  
  11.  
  12.  
  13. public class TabView extends Activity {
  14.  
  15.     /** Called when the activity is first created. */
  16.  
  17.     @Override
  18.  
  19.     public void onCreate(Bundle icicle) {
  20.  
  21.         super.onCreate(icicle);
  22.  
  23.         setContentView(R.layout.main);
  24.  
  25.        TabHost th=(TabHost)this.findViewById(android.R.id.tabhost);
  26.  
  27.        
  28.  
  29.         th.setup();
  30.  
  31.        
  32.  
  33.     }
  34.  
  35. }
Parsed in 0.011 seconds, using GeSHi 1.0.8.4


One more thing that i observed is, eclipse showing TabHost as deprecated.

Is there anything that i can try to show multiple tabs?
rock_win
Junior Developer
Junior Developer
 
Posts: 11
Joined: Mon Jan 21, 2008 4:24 pm

Top

Postby Marcel » Sat Mar 15, 2008 3:05 pm

Hi rock_win,

First you should upgrade to the newest SDK. In the older versions TabHost is marked as deprecated because its not yet fully implemented.

Also your layout xml isn't valid. You have to place all your content layouts within ONE TabWidget. I thinks its not even possible to have more than one TabWidget at the same time...

Check out these links for an exmaple:
http://www.jsharkey.org/blog/2008/02/07/using-android-tabhost/
http://www.jsharkey.org/blog/2008/02/14/android-tabhost-in-the-m5-sdk/
Marcel
Freshman
Freshman
 
Posts: 9
Joined: Sun Jan 20, 2008 7:49 pm
Location: Germany

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 4 guests