Please....What is problem??

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

Please....What is problem??

Postby sojo » Fri May 15, 2009 7:09 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 mangaluve » Sat May 16, 2009 11:55 am

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?
mangaluve
Experienced Developer
Experienced Developer
 
Posts: 82
Joined: Mon Mar 23, 2009 8:59 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 6 guests