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 8925639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:45:14+00:00 2026-06-15T07:45:14+00:00

Here is the layout I am trying to get. As long as I don’t

  • 0

Here is the layout I am trying to get. As long as I don’t actually try to populate my spinners, everything loads just fine. Based on what I have found in my searches and the log is that I need to use a TextView with the ArrayAdapter. Exactly how I do that while preserving the current layout – Spinners and a submit button at the top with a ListView for the returned results below the spinners is what I am having trouble achieving.

Here is my onCreate method.

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.master);
        DBHelper db = new DBHelper(this);
        List<Stations> st = db.getAllStations();
        List<CharSequence> stations = new ArrayList<CharSequence>();
        setList(4, 9);
        for (int i = 0; i < st.size(); i++)
        {
            stations.add(st.get(i).getStation());
        }
        ListView list = (ListView) findViewById(R.id.list);
        Spinner s1 = (Spinner) findViewById(R.id.spinnerStart);
        Spinner s2 = (Spinner) findViewById(R.id.spinnerEnd);

        ArrayAdapter<CharSequence> SimpleSpinner1 = new ArrayAdapter<CharSequence>(this, R.layout.spinner, R.id.textView1);
        ArrayAdapter<CharSequence> SimpleSpinner2 = new ArrayAdapter<CharSequence>(this, R.layout.spinner, R.id.textView1);
        SimpleAdapter nSchedule = new SimpleAdapter(this, departures, R.layout.row,
            new String[] {"train", "from", "to"}, new int[] {R.id.TRAIN_CELL, R.id.FROM_CELL, R.id.TO_CELL});
        for (CharSequence c : stations)
        {
            SimpleSpinner1.add(c);
            SimpleSpinner2.add(c);
        }
    list.setAdapter(nSchedule);
    s2.setAdapter(SimpleSpinner2);
    s1.setAdapter(SimpleSpinner1);

    }

master.xml

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

    <Spinner
        android:id="@+id/spinnerStart"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true" />

    <Spinner
        android:id="@+id/spinnerEnd"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/spinnerStart" />

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/spinnerEnd"
        android:text="Button" />

    <include
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/button1"
        layout="@layout/listview" />

</RelativeLayout>

spinner.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="30dp" >

        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_alignParentLeft="true"
            android:layout_below="@+id/textView1"
            android:textAppearance="?android:attr/textAppearanceLarge" />

    </RelativeLayout>
  • 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-06-15T07:45:15+00:00Added an answer on June 15, 2026 at 7:45 am

    Instead of R.id.spinnerStart / R.id.spinnerEnd you need to pass a textView

    EDIT:

    Spinner spinner1 = (Spinner)findViewById(R.id.spinner1);
    ArrayAdapter adapter = new ArrayAdapter(this, R.layout.spinner_item, R.id.textView1);
    spinner1.setAdapter(adapter);

    textView1 is present in spinner_item layout. Hope this is clear

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

Sidebar

Related Questions

I'm trying to create a layout similar to this: alt text http://img20.imageshack.us/img20/3533/stackn.png Here's the
see the jsfiddle here i'm trying to get the 'read more' links to slide
I'm having a little difficulties while trying to get a certain layout to work:
I have been trying to get this my damned layout to work for so
there are lots of layout questions when I search here, but I just can't
I am trying to make my listview only one row with just imageview. Here
here is the layout: <s:Scroller> <s:VGroup> <s:List id="list1"/> <s:List id="list2"/> <component:ThirdPartyComponent/> </s:VGroup> </s:Scroller> so,
Here's my layout code; <?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:text=@string/welcome
Here is my layout <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent android:id=@+id/LinearLayout01 android:layout_height=wrap_content> <Spinner android:text=@+id/AutoCompleteTextView01
Here is my layout, Summary view http://img689.imageshack.us/img689/2500/yuidtsum.jpg I am using one div and many

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.