Hi all, I've been trying to debug this problem all day long and can't seem
to find the breakthrough. I'm using tabhosts to create tabs on the main
screen, then I try to put list inside the other tab.To achieve that, I'm
using setContent(Intent e ) methods.. hoping that the list will be contained
on the tab.
Here's my errorr I'm getting: Did you forget to call 'public void
setup(LocalActivityManager activityGroup)'?
But as you see on the codes below, I already call tabs.setup();

So here's the structure of my program:

public class myHome extends  TabActivity {
@Override
public void onCreate(Bundle home) {
super.onCreate(home);
// call the home screen
try {
setContentView(R.layout.home);
} catch (Exception e) {
Log.e("ERROR0001", e.getMessage());
// TODO: handle exception
}

// do the actual work here...

// manage tab
try {
final TabHost tabs = (TabHost) findViewById(R.id.tabhost);
tabs.setup();

    TabSpec tab = tabs.newTabSpec("TabOne");
    tab.setContent(R.id.home_scroll);
    tab.setIndicator("TabOne");
    tabs.addTab(tab);

//    tabs.setup();
    tab = tabs.newTabSpec("TabTwo");
//    tab.setContent(R.id.home_scroll_events);
    tab.setContent(new Intent(this, myList.class));
    tab.setIndicator("TabTwo");
    tabs.addTab(tab);

  tabs.setCurrentTab(1);

} catch (Exception e) {
// TODO: handle exception
Log.e("ERROR0002", e.getMessage());
}

}

It triggers the second exception (ERROR0002) when it reach
tabs.setCurrentTab(1)
Commenting out the setContent(Intent) method and use R.id, everything works
fine... minus the list I wanted...
Here is the error:

java.lang.IllegalStateException: Did you forget to call 'public void
setup(LocalActivityManager activityGroup)'?

I already add
                <activity android:name=".myList"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar">
</activity>

on the android manifest file

Here's the content of myList.java

public class myList extends ListActivity {

@Override
public void onCreate(Bundle home_list) {
super.onCreate(home_list);
          setContentView(R.layout.two);

String[] items={"lorem", "ipsum", "dolor", "sit", "amet",
"consectetuer", "adipiscing", "elit", "morbi", "vel",
"ligula", "vitae", "arcu", "aliquet", "mollis",
"etiam", "vel", "erat", "placerat", "ante",
"porttitor", "sodales", "pellentesque", "augue"};
 this.setListAdapter(new ArrayAdapter<String>(this,
R.layout.row, R.id.label,
items));
 }
}

where two.xml is simply like this:

<?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"
    >
<TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="Second tab"
    />
</LinearLayout>

and here is row.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android";
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<TextView
android:id="@+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="44sp"
/>
<TextView
android:id="@+id/information"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:text="life.."
/>
</LinearLayout>

I must have missing something here...can anyone please help?

Thanks.
-- 
Lawrence Samantha

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to