I have set up four tabs that each hold a listview, I have added code in the listview java file to make the lists transparent, however, I have a semi transparent grey box covering 75% of the screen and I cannot figure out why, I have a background on my other listviews and they are completely transparent, but the lists within the tabhost have the grey box.
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="2dp">
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="3dp"
android:layout_weight="1"/>
<TabWidget
android:id="#android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0"/>
</LinearLayout>
</TabHost>
import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;
public class Tabs extends TabActivity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Resources res = getResources(); // Resource object to get Draw
TabHost tabHost = getTabHost(); // The activity TabHost
TabHost.TabSpec spec; // Reusable TabSpec for each tab
Intent intent; // Reusable Intent for each tab
// Create an Intent to launch an Activity for the tab (to be reused)
intent = new Intent().setClass(this, prem.class);
// Initialise a TabSpec for each tab and add it to the TabHost
spec = tabHost.newTabSpec("Prem").setIndicator("Prem",
res.getDrawable(R.drawable.icontabs))
.setContent(intent);
tabHost.addTab(spec);
// Create an Intent to launch an Activity for the tab (to be reused)
intent = new Intent().setClass(this, champ.class);
// Initialise a TabSpec for each tab and add it to the TabHost
spec = tabHost.newTabSpec("Champ").setIndicator("Champ",
res.getDrawable(R.drawable.champ))
.setContent(intent);
tabHost.addTab(spec);
// Do the same for the other tabs
intent = new Intent().setClass(this, l1.class);
spec = tabHost.newTabSpec("League 1").setIndicator("L",
res.getDrawable(R.drawable.l1))
.setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, ll2.class);
spec = tabHost.newTabSpec("l2").setIndicator("Le",
res.getDrawable(R.drawable.l2))
.setContent(intent);
tabHost.addTab(spec);
tabHost.setCurrentTab(0);
}
}
public class l1 extends ListActivity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
// Create an array of Strings, that will be put to our ListActivity
String[] names = new String[] {"Le"};
ListView lv = getListView();
lv.setBackgroundResource(R.drawable.le2);
lv.setCacheColorHint(00000000);
this.setListAdapter(new ArrayAdapter<String>(this,
R.layout.list_item, names));
}
// Get the item that was clicked
#Override
public void onListItemClick(ListView l, View v, int position, long id) {
if (position == 0) {
In your layout XML file, your tab content (the FrameLayout) should be after the tab widget, not before. It's possible the box you are seeing is the tab widget's background.
Like this:
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabWidget
android:id="#android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
</TabHost>
Related
So, i was following the NewBoston series on Android tutorials. So, there is this tutorial on setting up tabs using Tabhost and Tabspecs. Now, i tried exactly what the tutorial does but crashes and it points to a particular line in my code which is setContentView() method in the OnCreate(). I tried even removing it and ran the code but the program just crashes. What could be my mistake? I also tried the code in the following article to see if that works but it still crashes.
http://www.learn-android-easily.com/2013/07/android-tabwidget-example.html
This is my code-
Splash.java is the class that starts up the Launcher activity
public class Splash extends TabActivity {
TabHost th;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
th = (TabHost)findViewById(R.id.tabHost2);
TabHost.TabSpec tab1 = th.newTabSpec("First Tab");
TabHost.TabSpec tab2 = th.newTabSpec("Second Tab");
TabHost.TabSpec tab3 = th.newTabSpec("Third tab");
tab1.setIndicator("Tab1");
tab1.setContent(new Intent(this,TabActivity1.class));
tab2.setIndicator("Tab2");
tab2.setContent(new Intent(this, TabActivity2.class));
tab3.setIndicator("Tab3");
tab3.setContent(new Intent(this, TabActivity3.class));
th.addTab(tab1);
th.addTab(tab2);
th.addTab(tab3);
}
}
TabActivity1.java-
public class TabActivity1 extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv=new TextView(this);
tv.setTextSize(25);
tv.setGravity(Gravity.CENTER_VERTICAL);
tv.setText("This Is Tab1 Activity");
setContentView(tv);
}
}
TabActivity2.java:-
public class TabActivity2 extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv=new TextView(this);
tv.setTextSize(25);
tv.setGravity(Gravity.CENTER_VERTICAL);
tv.setText("This Is Tab2 Activity");
setContentView(tv);
}
}
TabActivity3.java
public class TabActivity3 extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv=new TextView(this);
tv.setTextSize(25);
tv.setGravity(Gravity.CENTER_VERTICAL);
tv.setText("This Is Tab3 Activity");
setContentView(tv);
}
}
splash.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TabHost
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/tabHost2"
android:layout_gravity="center_horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TabWidget
android:id="#android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"></TabWidget>
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"></LinearLayout>
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"></LinearLayout>
<LinearLayout
android:id="#+id/linearLayout3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"></LinearLayout>
</FrameLayout>
</LinearLayout>
</TabHost>
</LinearLayout>
Change this line
th = (TabHost)findViewById(R.id.tabHost2);
to
th = (TabHost)findViewById(android.R.id.tabHost2);
This will do.
Because, in the layout file, you might have set Tabhost id like this android:id="#android:id/tabhost2">
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I'm trying to put a listView (existing list named sitesList) in a TabHost but when I run my app, it closes (without the code for tabhost the app works), here is my code:
public class MainActivity extends TabActivity {
private SitesAdapter mAdapter;
private ListView sitesList;
private static final String Noutati = "Noutati";
private static final String Favorite = "Favorite";
private static final String PROFILE_SPEC = "Profile";
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.i("StackSites", "OnCreate()");
setContentView(R.layout.activity_main);
TabHost tabHost = getTabHost();
TabSpec inboxSpec = tabHost.newTabSpec(Noutati);
Intent inboxIntent = new Intent(this, Noutati.class);
inboxSpec.setContent(inboxIntent);
TabSpec outboxSpec = tabHost.newTabSpec(Favorite);
//Intent outboxIntent = new Intent(this, OutboxActivity.class);
//outboxSpec.setContent(outboxIntent);
tabHost.addTab(inboxSpec);
tabHost.addTab(outboxSpec);
sitesList = (ListView)findViewById(R.id.sitesList);
...
public class Noutati extends ListActivity {
private ListView sitesList;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.noutati);
sitesList = (ListView)findViewById(R.id.sitesList);
this.setListAdapter((android.widget.ListAdapter) sitesList);
}
}
Activity_main
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabWidget
android:id="#android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</LinearLayout>
noutati.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="fill_parent"
android:orientation="vertical" >
<ListView
android:id="#+id/sitesList"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
Thank you very much
EDIT:
I see that you have named your variable Noutati and your class Noutati. Thy changing the variable to something like noutatiName.
As I have never encountered this before, I'm not sure this will work, but the error most likely appears because you have to set the indicator for each tab spec.
So after TabSpec inboxSpec = tabHost.newTabSpec(Noutati); you should also type inboxSpec .setIndicator("Notuati");
Hope it helps!
Also you should do that after TabSpec outboxSpec = tabHost.newTabSpec(Favorite);
Link
I am making tabs in android. Currently this is how my tabs are working. When I click on any tab it will take me to appropriate tab's view which is fine. But lets say when I click on Profile tab then inside this profile view there is a button Add New. When I click on Add New button then it takes me to it's view but it also removes tabs from the view which I don't want. So how can I make tabs always available even when user clicks any link or button inside any view?
Here is my current code
tabs.xml
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp">
<TabWidget
android:id="#android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" />
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp" />
</RelativeLayout>
</TabHost>
Tabs.java
public class Tabs extends TabActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.tabs);
Resources resources = getResources();
TabHost tabHost = getTabHost();
Intent startUseSaldo = new Intent().setClass(this, Usesaldo.class);
TabSpec useSaldo = tabHost
.newTabSpec("UseSaldo")
.setIndicator("Use Saldo")
.setContent(startUseSaldo);
Intent startHistory = new Intent().setClass(this, History.class);
TabSpec history = tabHost
.newTabSpec("History")
.setIndicator("History")
.setContent(startHistory);
Intent startProfile = new Intent().setClass(this, Profile.class);
TabSpec profile = tabHost
.newTabSpec("Profile")
.setIndicator("Profile")
.setContent(startProfile);
// add all tabs
tabHost.addTab(useSaldo);
tabHost.addTab(history);
tabHost.addTab(profile);
tabHost.setCurrentTab(1);
}
}
Profile.java
public class Profile extends Activity {
Button bAddNew;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.profile);
bAddNew = (Button)findViewById(R.id.bAddNew);
bAddNew.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Intent AddFacility = new Intent(getApplicationContext(), AddFacility.class);
startActivity(AddFacility);
}
});
}
}
AddFacility.java
public class AddFacility extends Activity {
#Override
public void setContentView(int layoutResID) {
// TODO Auto-generated method stub
super.setContentView(R.layout.add_facility);
}
}
Try this example - http://gamma-point.com/content/android-how-have-multiple-activities-under-single-tab-tabactivity
You have to use ActivityGroup with Tabhost
http://richipal.com/post/2624844577
But as ActivityGroups are depericated you should use Fragments with Tabhost
As an example, see the following tutorial on how my tabs are setup initially.
Instead of a normal activity running on one of the tabs, I want another TabActivity. So what I'm trying to do is run a TabActivity within a TabActivity. I believe the issue is that the ID's conflict. I have tried to solve this by changing the ID's on the secondary activity's xml file and calling those manually in the activity, but have had no luck.
I have been searching for hours for a solution for this, but have come up with nothing.
Multiple tab activities with an application is possible.
For instance:
App contains a Launcher TabActivity (HomeTabActivity) with two tabs : Tab 1 and Tab 2
Tab 1 can be a TabActivity with two or more tabs.
Tab 2 can be a TabActivity with two or more tabs.
FirstTab, SecondTab, ThirdTab and FourthTab are simple activities actings as child for child of HomeTabActivity.
xml files containing TabHost as parent element
1. hometab.xml
2. tab1.xml
3. tab2.xml
To differentiate between HomeTabActivity and Its child TabActivities i.e Tab1 and Tab2
I have put TabWidget at top for HomeTabActivity and at bottom for Tab1 and Tab2.
HomeTabActivity (Very First Main Tab Activity):
public class HomeTabActivity extends TabActivity
{
private TabHost mTabHost = null;
private Intent mIntent = null;
private TabHost.TabSpec mTabSpec = null;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.hometab);
initializeTabs();
}
private void initializeTabs() {
mTabHost = getTabHost();
mIntent = new Intent().setClass(this, Tab1.class);
mTabSpec = mTabHost
.newTabSpec("Tab1")
.setIndicator("Tab1",
getResources().getDrawable(R.drawable.ic_launcher))
.setContent(mIntent);
mTabHost.addTab(mTabSpec);
mIntent = new Intent().setClass(this, Tab2.class);
mTabSpec = mTabHost
.newTabSpec("Tab2")
.setIndicator("Tab2",
getResources().getDrawable(R.drawable.ic_launcher))
.setContent(mIntent);
mTabHost.addTab(mTabSpec);
mTabHost.setCurrentTab(0);
}
}
Tab1 (TabActivity Embedded inside the HomeTabActivity) :
public class Tab1 extends TabActivity
{
private TabHost mTabHost = null;
private Intent mIntent = null;
private TabHost.TabSpec mTabSpec = null;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.tab1);
initializeTabs();
}
private void initializeTabs() {
mTabHost = getTabHost();
mIntent = new Intent().setClass(this, FirstTab.class);
mTabSpec = mTabHost
.newTabSpec("Tab1 Child 1")
.setIndicator("Tab1 Child 1",
getResources().getDrawable(R.drawable.ic_launcher))
.setContent(mIntent);
mTabHost.addTab(mTabSpec);
mIntent = new Intent().setClass(this, SecondTab.class);
mTabSpec = mTabHost
.newTabSpec("Tab1 Child 2")
.setIndicator("Tab1 Child 2",
getResources().getDrawable(R.drawable.ic_launcher))
.setContent(mIntent);
mTabHost.addTab(mTabSpec);
mTabHost.setCurrentTab(0);
}
}
Tab2 (Another TabActivity Embedded inside the HomeTabActivity) :
public class Tab2 extends TabActivity
{
private TabHost mTabHost = null;
private Intent mIntent = null;
private TabHost.TabSpec mTabSpec = null;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.tab2);
initializeTabs();
}
private void initializeTabs() {
mTabHost = getTabHost();
mIntent = new Intent().setClass(this, ThirdTab.class);
mTabSpec = mTabHost
.newTabSpec("Tab2 Child 1")
.setIndicator("Tab2 Child 1",
getResources().getDrawable(R.drawable.ic_launcher))
.setContent(mIntent);
mTabHost.addTab(mTabSpec);
mIntent = new Intent().setClass(this, FourthTab.class);
mTabSpec = mTabHost
.newTabSpec("Tab2 Child 2")
.setIndicator("Tab2 Child 2",
getResources().getDrawable(R.drawable.ic_launcher))
.setContent(mIntent);
mTabHost.addTab(mTabSpec);
mTabHost.setCurrentTab(1);
}
}
hometab.xml
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TabWidget
android:id="#android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</TabWidget>
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</FrameLayout>
</LinearLayout>
</TabHost>
tab1.xml and tab2.xml
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/androidblue"
android:layout_weight="1">
</FrameLayout>
<TabWidget
android:id="#android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0">
</TabWidget>
</LinearLayout>
</TabHost>
I am having trouble trying to figure out how to convert my current tab setup to one that uses views and not seperate activities... I have issues with calling my search function and I think it is due to the way I have created my tabs.
My main launcher activity is public class Menu extends TabActivity which creates the tabs
intent = new Intent().setClass(this, TabGroup1.class);
// Initialize a TabSpec for each tab and add it to the TabHost
spec = tabHost.newTabSpec("codes").setIndicator("All Codes",res.getDrawable(R.drawable.ic_tab_codes))
.setContent(intent);
tabHost.addTab(spec);
`TabGroup1' does the following for each tab
public class TabGroup1 extends TabGroupActivity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
startChildActivity("Category", new Intent(this,Category.class));
}
}
Which then calls the ListActivity which shows the content from there when an item is clicked another intent is created which then starts a new activity which allows me to have the tabs on each level as the user goes down the lists.
This is done with the following code
public void onListItemClick(ListView parent, View view, int position, long id) {
Intent intent = new Intent(getParent(), SubCategory.class);
Cursor cursor = (Cursor) adapter.getItem(position);
intent.putExtra("CATEGORY", cursor.getString(cursor.getColumnIndex("_id")));
/*startActivity(intent);*/
TabGroupActivity parentActivity = (TabGroupActivity)getParent();
parentActivity.startChildActivity("SubCategory", intent);
}
TabGroupActivity is a class which I found from a tutorial that allows you to have multiple activities under the same tab layout.
What I am struggling is with converting what I have to using views and using setContent to change the views.
I have found this example but it doesn't provide enough detail for me to go on.
Also found this one as well...
Can someone please provide me the run down on what I need to change and also how do I setContent using my listactivities...
Thanks in advance
A couple things... setContent defines the content, it doesn't cause the switching of tabs. If you want to force a change to a certain tab you use TabHost.setCurrentTab(tabid);, otherwise it defaults to the first tab, then whatever the user chooses.
An example from one of my own projects (This project actually has four tabs, but I've cut out some to try and keep this to the point). There are several ways to do it, but I found the easiest was to create a method to populate each tab, that way I could refresh a tab as needed by calling the appropriate method for whichever tab I needed (all of the java below is contained in the TabActivity).
setupdetailmain.xml
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="5dp" >
<TextView
android:id="#+id/setupheader"
android:layout_width="fill_parent"
android:layout_height="20dp"
android:textSize="15dp" />
<TabWidget
android:id="#android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="30dp"
android:gravity="bottom" />
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp" >
<!-- General Info Tab -->
<LinearLayout
android:id="#+id/note_tab"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
</LinearLayout>
<!-- Tool Tab -->
<LinearLayout
android:id="#+id/offset_tab"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ListView
android:id="#+id/list2"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:drawSelectorOnTop="false" />
</LinearLayout>
</FrameLayout>
</LinearLayout>
</TabHost>
tab setup code (extends TabActivity)
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.setupdetailmain);
// ***************************************************************
// Set up the tabs in the tabhost
// ***************************************************************
tabHost = getTabHost();
TabHost.TabSpec spec;
spec = tabHost.newTabSpec("Offsets").setIndicator("Offsets")
.setContent(R.id.offset_tab);
tabHost.addTab(spec);
spec = tabHost.newTabSpec("Notes").setIndicator("Notes")
.setContent(R.id.note_tab);
tabHost.addTab(spec);
populateTabs(StartTab);
}
tab populate methods
// ***************************************************************
// Fill the Notes tab
// ***************************************************************
private void notestab() {
notes = (LinearLayout) findViewById(R.id.note_tab);
notestxt = new TextView(this);
notestxt.setText(SETUPINFO_NOTES);
notestxt.setTextSize(15);
notes.addView(notestxt);
}
// ***************************************************************
// Fill the Offset tab
// ***************************************************************
private void offsettab() {
wpccount = 0;
for (int i = 0; i < 20; i++) {
if (wpcdesc[i] != null) {
wpcdisplayhold[wpccount] = wpcid[i] + " - " + wpcdesc[i];
wpcidhold[wpccount] = wpcid[i];
wpcdeschold[wpccount] = wpcdesc[i];
wpccount++;
}
}
wpcdisplay = new String[wpccount];
for (int i = 0; i < wpccount; i++) {
wpcdisplay[i] = wpcdisplayhold[i];
}
mWPCView = (ListView) findViewById(R.id.list2);
mWPCView.setAdapter(new ColorizingListAdapter(SetupDisplay.this,
wpcdisplay, "Offset"));
registerForContextMenu(mWPCView);
}
This uses a custom adapter, but hopefully it gets across the idea of how to set up your lists in a tab view without doing a new activity.