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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:00:21+00:00 2026-06-13T02:00:21+00:00

Hi i have to develop one spinner example. list is added on spinner box:

  • 0

Hi i have to develop one spinner example.

list is added on spinner box:

List<String> list = new ArrayList<String>();
Intent in = getIntent();

String status = in.getStringExtra(KEY_STATUS);
list.add(status);
list.add("Q");
list.add("P");
list.add("F");
list.add("I");
list.add("C");

Here the status is getting from previous activity status value.other list is defaulty Q,P,F,I and C.because the first list is displayed pervious status only.so only i have to added status first here.ahere dd all values into list including replication
then using for loop check for the current status and try to remove from the list.this concept is am used here.

This is my code:

public class InsertionExample extends Activity {
private final String NAMESPACE = "http://xcart.com";
private final String URL = "http://192.168.1.168:8089/XcartLogin/services/update?wsdl";
private final String SOAP_ACTION = "http://xcart.com/insertData";
private final String METHOD_NAME = "insertData";
Button btninsert;
String selectedItem;
private int i;

static final String KEY_NAME = "orderid";
static final String KEY_STATUS = "status";
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final boolean customTitleSupported = requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
    setContentView(R.layout.change_status);
    if (customTitleSupported) {
        getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.window_title);
    }

    final TextView myTitleText = (TextView) findViewById(R.id.mytitle);
    if (myTitleText != null) {
        myTitleText.setText("Change Order Status");
    }
  /*  Intent in = getIntent();

    // Get XML values from previous intent
    String orderid = in.getStringExtra(KEY_NAME);

    // Displaying all values on the screen
    TextView lblName = (TextView) findViewById(R.id.textView1);


    lblName.setText(orderid); */


    Spinner spinner = (Spinner) findViewById(R.id.spinner1);
    btninsert = (Button)findViewById(R.id.btn_insert1);
    btninsert.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
             Intent in = getIntent();
             String orderid = in.getStringExtra(KEY_NAME);
             String status = in.getStringExtra(KEY_STATUS);
            SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
            PropertyInfo unameProp =new PropertyInfo();
            unameProp.setName("Status");//Define the variable name in the web service method
            unameProp.setValue(selectedItem);//Define value for fname variable
            unameProp.setType(String.class);//Define the type of the variable

            request.addProperty(unameProp);
            PropertyInfo idProp =new PropertyInfo();
            idProp.setName("Orderid");//Define the variable name in the web service method
            idProp.setValue(orderid);//Define value for fname variable
            idProp.setType(String.class);//Define the type of the variable
            request.addProperty(idProp);



              SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
              envelope.setOutputSoapObject(request);
              HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

              try{
               androidHttpTransport.call(SOAP_ACTION, envelope);
                  SoapPrimitive response = (SoapPrimitive)envelope.getResponse();

                 TextView result = (TextView) findViewById(R.id.textView2);
                  result.setText(response.toString());
             }
           catch(Exception e){

           }
              }
    });

    //attach the listener to the spinner
    spinner.setOnItemSelectedListener(new MyOnItemSelectedListener());
    //Dynamically generate a spinner data 
    createSpinnerDropDown();

    }

    //Add animals into spinner dynamically
     private void createSpinnerDropDown() {

    //get reference to the spinner from the XML layout
    Spinner spinner = (Spinner) findViewById(R.id.spinner1);

    //Array list of animals to display in the spinner
    List<String> list = new ArrayList<String>();
    Intent in = getIntent();

    String status = in.getStringExtra(KEY_STATUS);
    list.add(status);
    list.add("Q");
    list.add("P");
    list.add("F");
    list.add("I");
    list.add("C");
    for(i=0;i<((TextView) list).length();i++){
        if(list.get(i).equals(status)) {
                list.remove(list.get(i));
        }
     }
    //create an ArrayAdaptar from the String Array
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
            android.R.layout.simple_spinner_item, list);
    //set the view for the Drop down list
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    //set the ArrayAdapter to the spinner
    spinner.setAdapter(adapter);
    adapter.notifyDataSetChanged();
    //attach the listener to the spinner
    spinner.setOnItemSelectedListener(new MyOnItemSelectedListener());

  }
  public class MyOnItemSelectedListener implements OnItemSelectedListener {

    public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {

         selectedItem = parent.getItemAtPosition(pos).toString();

       }


    @Override
    public void onNothingSelected(AdapterView<?> arg0) {
        // TODO Auto-generated method stub

    }



    }

    public void onNothingSelected(AdapterView<?> parent) {
        // Do nothing.
    }
   }

Here my app is force closed.also getting following error on my console window:

  10-15 16:34:02.021: D/dalvikvm(2203): GC_EXTERNAL_ALLOC freed 947 objects / 65120 bytes in 61ms
  10-15 16:39:29.661: D/dalvikvm(2203): GC_FOR_MALLOC freed 5616 objects / 350760 bytes in 56ms
  10-15 16:39:30.342: D/dalvikvm(2203): GC_FOR_MALLOC freed 8368 objects / 548488 bytes in 52ms
  10-15 16:39:32.082: W/drawable(2203): Bad element under <shape>: margin
  10-15 16:39:32.092: W/drawable(2203): Bad element under <shape>: margin
  10-15 16:39:32.172: D/dalvikvm(2203): GC_FOR_MALLOC freed 5508 objects / 311288 bytes in 51ms
   10-15 16:39:32.172: I/dalvikvm-heap(2203): Grow heap (frag case) to 2.912MB for 87396-byte allocation
   10-15 16:39:32.232: D/dalvikvm(2203): GC_FOR_MALLOC freed 136 objects / 5536 bytes in 52ms
    10-15 16:39:32.292: D/dalvikvm(2203): GC_FOR_MALLOC freed 0 objects / 0 bytes in 58ms
   10-15 16:39:32.292: I/dalvikvm-heap(2203): Grow heap (frag case) to 2.990MB for 87396-byte allocation
   10-15 16:39:32.352: D/dalvikvm(2203): GC_FOR_MALLOC freed 70 objects / 2880 bytes in 55ms
    10-15 16:39:32.671: D/dalvikvm(2203): GC_FOR_MALLOC freed 6159 objects / 257232 bytes in 57ms
    10-15 16:39:33.042: D/dalvikvm(2203): GC_FOR_MALLOC freed 20488 objects / 928728 bytes in 55ms
     10-15 16:39:36.112: D/AndroidRuntime(2203): Shutting down VM
     10-15 16:39:36.112: W/dalvikvm(2203): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
     10-15 16:39:36.142: E/AndroidRuntime(2203): FATAL EXCEPTION: main
     10-15 16:39:36.142: E/AndroidRuntime(2203): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.androidlogin.ws/com.androidlogin.ws.InsertionExample}: java.lang.ClassCastException: java.util.ArrayList
      10-15 16:39:36.142: E/AndroidRuntime(2203):   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
     10-15 16:39:36.142: E/AndroidRuntime(2203):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
     10-15 16:39:36.142: E/AndroidRuntime(2203):    at android.app.ActivityThread.access$2300(ActivityThread.java:125)
     10-15 16:39:36.142: E/AndroidRuntime(2203):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
      10-15 16:39:36.142: E/AndroidRuntime(2203):   at android.os.Handler.dispatchMessage(Handler.java:99)
      10-15 16:39:36.142: E/AndroidRuntime(2203):   at android.os.Looper.loop(Looper.java:123)
      10-15 16:39:36.142: E/AndroidRuntime(2203):   at android.app.ActivityThread.main(ActivityThread.java:4627)
       10-15 16:39:36.142: E/AndroidRuntime(2203):  at java.lang.reflect.Method.invokeNative(Native Method)
      10-15 16:39:36.142: E/AndroidRuntime(2203):   at java.lang.reflect.Method.invoke(Method.java:521)
     10-15 16:39:36.142: E/AndroidRuntime(2203):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
      10-15 16:39:36.142: E/AndroidRuntime(2203):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
     10-15 16:39:36.142: E/AndroidRuntime(2203):    at dalvik.system.NativeStart.main(Native Method)
     10-15 16:39:36.142: E/AndroidRuntime(2203): Caused by: java.lang.ClassCastException: java.util.ArrayList
     10-15 16:39:36.142: E/AndroidRuntime(2203):    at com.androidlogin.ws.InsertionExample.createSpinnerDropDown(InsertionExample.java:122)
       10-15 16:39:36.142: E/AndroidRuntime(2203):  at com.androidlogin.ws.InsertionExample.onCreate(InsertionExample.java:101)
  10-15 16:39:36.142: E/AndroidRuntime(2203):   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
   10-15 16:39:36.142: E/AndroidRuntime(2203):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
  10-15 16:39:36.142: E/AndroidRuntime(2203):   ... 11 more
   10-15 16:39:38.791: D/dalvikvm(2210): GC_EXTERNAL_ALLOC freed 976 objects / 66240 bytes in 50ms

please give me solution for this.

  • 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-13T02:00:23+00:00Added an answer on June 13, 2026 at 2:00 am

    use this condition:

    for(i=0;i<list.size();i++){
            if(list.get(i).equals(status)) {
                    list.remove(list.get(i));
            }
     }
    

    Hopefully it is worked for all.

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

Sidebar

Related Questions

Hi i have to develop one spinner example in android.here i have to used
I have a GlassFish/j2ee application, and I develop on one box, and production is
I have develop one app in which four box question are there. all question
Hi i have to develop one spinner app. here how can i remove the
I have develop one web site in php. I know how to upload it
Hi i have develop and deploy one multilingual (english uk and swedish) website at
I am new in Android. I have develop an app. And now want to
I have to develop a simple parser, to read block of text for example:
I have to develop one ExpandableListView. Here i wish to set the arrow icon
I have to develop one program that consists data manipulation (retrieve data, update data

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.