hi guys,

i want to display a Spinner once menu item is selected. how can this
be done. do i have to define the spinner in different xml file???

i have define the spinner in the current activities xml file. so once
i call setContentView(current.xml) the spinner is getting loaded.

i don't want to load the spinner in onCreate method.

i want it to be displayed only user selects a menu item.

this is what i'hv done

this is my xml file

<?xml version="1.0" encoding="utf-8"?>


<ScrollView xmlns:android="http://schemas.android.com/apk/res/android";
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:scrollbarSize="12dip">


<LinearLayout
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:paddingTop="10dip"
  android:orientation="vertical">

          <EditText
                  android:id="@+id/num"
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content"
                  android:hint="To:"
                  android:enabled="false"
                  android:clickable="false"
          />

  <LinearLayout
          android:orientation="horizontal"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content">

          <TextView
                  android:id="@+id/txt"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:paddingTop="15dip"
          />

          <ImageView
                android:id="@+id/shp"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
          />

  <RelativeLayout
          android:orientation="horizontal"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content">

          <ImageButton
                  android:id="@+id/cnt"
                  android:src="@drawable/plus"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_alignParentRight="true"

          />
  </RelativeLayout>
</LinearLayout>


    <LinearLayout
          android:orientation="vertical"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          >

          <EditText
                  android:id="@+id/msg"
                  android:hint="Message:"
                  android:layout_height="50px"
                  android:layout_width="fill_parent"
                  android:gravity="top"
                  android:scrollbars="vertical"
                  android:paddingTop="10dip"
          />

        <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Timer :"
                android:paddingTop="10dip"
        />

          </LinearLayout>


        <RelativeLayout
          android:orientation="horizontal"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:paddingTop="10dip">

                  <Button
                          android:id="@+id/snd"
                          android:layout_width="fill_parent"
                          android:layout_height="wrap_content"
                          android:text="Send"
                          android:layout_alignParentRight="true"
                  />
        </RelativeLayout>


        <Spinner
                android:id="@+id/mmsSpinner"
            android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:drawSelectorOnTop="true"
        android:prompt="@string/spinnerExtra"
        android:paddingTop="10dip"
          />

</LinearLayout>
</ScrollView>

and this is my onCreate method

        protected void onCreate(Bundle savedInstanceState) {
                // TODO Auto-generated method stub
                Context context;
                super.onCreate(savedInstanceState);
                setContentView(R.layout.compose_sms);
}

this is my Options Menu

        @Override
        public boolean onOptionsItemSelected(MenuItem item) {
                // TODO Auto-generated method stub
                switch (item.getItemId()) {
                case R.id.mms:
spinnerMMS = (Spinner) findViewById(R.id.mmsSpinner);
                        SpinnerAdapter mmsArray = new ArrayAdapter(this,
                                        android.R.layout.simple_spinner_item,
                                        Constants.MMS_LIST);
                        spinnerMMS.setAdapter(mmsArray);


                        return true;
                }
                return false;
        }

but this won't pop up spinner

can somebody how can i achieve this?
regards,
Mike

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

Reply via email to