Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3219774
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:41:06+00:00 2026-05-17T15:41:06+00:00

package com.example.helloandroid; import java.util.ArrayList; import java.util.Arrays; import android.app.TabActivity; import android.os.Bundle; import android.view.Window; import android.widget.ArrayAdapter;

  • 0
package com.example.helloandroid;

import java.util.ArrayList;
import java.util.Arrays;

import android.app.TabActivity;
import android.os.Bundle;
import android.view.Window;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TabHost;

public class HelloAndroid extends TabActivity {
/** Called when the activity is first created. */
private ListView mainListView ;  
private ArrayAdapter<String> listAdapter ;
@Override


public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.main);

    TabHost mTabHost = getTabHost();

    mTabHost.addTab(mTabHost.newTabSpec("tab_test1").setIndicator("TAB 1"));
    mTabHost.addTab(mTabHost.newTabSpec("tab_test2").setIndicator("TAB 2"));
    mTabHost.addTab(mTabHost.newTabSpec("tab_test3").setIndicator("TAB 3"));

    mTabHost.setCurrentTab(0);

 // Find the ListView resource.   
    mainListView = (ListView) findViewById( R.id.lstMain);  

    // Create and populate a List of planet names.  
    String[] planets = new String[] { "Mercury", "Venus", "Earth", "Mars",  
                                      "Jupiter", "Saturn", "Uranus", "Neptune"};    
    ArrayList<String> planetList = new ArrayList<String>();  
    planetList.addAll( Arrays.asList(planets) );  

    // Create ArrayAdapter using the planet list.  
   listAdapter = new ArrayAdapter<String>(this, R.layout.main, planetList);  

    // Set the ArrayAdapter as the ListView's adapter.  
    mainListView.setAdapter( listAdapter ); 


 // End


}

}

and here is the code for my xml file.

<?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">
        <TextView 
            android:id="@+id/textview1"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" 
            android:text="this is a tab" />
        <TextView 
            android:id="@+id/textview2"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" 
            android:text="this is another tab" />
        <TextView 
            android:id="@+id/textview3"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" 
            android:text="this is a third tab" />
        <ListView
            android:id="@+id/lstMain" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content">

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T15:41:07+00:00Added an answer on May 17, 2026 at 3:41 pm

    maybe if you look at two of my blog articles it might give you some helpful ideas.
    check out multiple-android-activities
    also take a look at the Configuring Android Listview article as well.
    Hope it helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

package com.example.helloandroid; import android.app.Activity; import android.os.Bundle; import android.widget.Button; import android.view.View; import android.view.View.OnClickListener; //Create an
Main Activity Code. BroadcastExample.java package com.example.broadcast; import android.app.Activity; import android.os.Bundle; import android.util.Log; public class
package com.example.Calc; import android.R.string; import android.app.ListActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter;
package com.example.android.home; import android.app.Activity; import android.os.Bundle; import android.widget.*; import android.view.*; public class HomeActivity extends
package com.example.helloandroid; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class HelloAndroid extends Activity {
Here is My Whole Code....... BroadcastExample.java package com.example.broadcast; > import android.app.Activity; import > android.content.Context;
package com.example.helloandroid; import java.io.File; import android.os.AsyncTask; import android.os.Environment; import android.widget.Toast; public class CheckTask extends
Here is my main: package com.example.frags; import android.app.Activity; import android.os.Bundle; import android.support.v4.app.FragmentTransaction; import android.support.v4.app.Fragment;
I'm trying out the LoaderCursor example in the API Demo: package com.example.android.apis.app; import android.app.Activity;
The code is also at https://github.com/timp21337/java-generics-example package a; import java.util.List; public interface Container<T> {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.