Please....What is problem??

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

Please....What is problem??

Postby sojo » Fri May 15, 2009 7:13 pm

Hi,
The following code does not work......What is problem?

***java code:-
package com.tabj;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TabHost;

public class tabj extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TabHost tabs = (TabHost)this.findViewById(R.id.tabs);
tabs.setup();

TabHost.TabSpec one = tabs.newTabSpec("one");
one.setContent(R.id.content1);
one.setIndicator("labelone");
tabs.addTab(one);

TabHost.TabSpec two = tabs.newTabSpec("two");
two.setContent(R.id.content2);
two.setIndicator("labeltwo");
tabs.addTab(two);




}
}
***xml
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>

<TabHost
id="@+id/tabs"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>

<TabWidget
id="@android:id/tabs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>

<FrameLayout
id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="200px"
android:paddingTop="30px"
>

<LinearLayout
id="@+id/content1"
android:orientation ="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ff99ccff"
>

<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="tab item uno :)"
/>

</LinearLayout>

<LinearLayout
id="@+id/content2"
android:orientation= "vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffcc99"
>

<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="tab item dos :/"
/>

<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="tabhost needs"
/>

<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="to be upgraded ;)"
/>

</LinearLayout>

</FrameLayout>

</TabHost>

</LinearLayout>


Please Help....
Thanks
sojo
Developer
Developer
 
Posts: 35
Joined: Sat Apr 25, 2009 2:06 am

Top

Postby n5r11 » Sun May 17, 2009 8:36 pm

mangaluve wrote:Please think about three things when posting:

1. Don't write that kind of subject, make a short subject about the problem instead.
2. Use java/xml formatting, it's a bitch to try to read code without it.
3. What is the problem? Won't the code build? Does the program crash? What happens?

4. Why are you posting the same question in more than one forum?
n5r11
Junior Developer
Junior Developer
 
Posts: 11
Joined: Sun May 17, 2009 2:29 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Exabot [Bot] and 17 guests