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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:34:13+00:00 2026-06-13T00:34:13+00:00

Hi i have to develop one spinner example in android.here i have to used

  • 0

Hi i have to develop one spinner example in android.here i have to used below 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);
    setContentView(R.layout.change_status);
    Intent in = getIntent();
    String status = in.getStringExtra(KEY_STATUS);
    String[] DayOfWeek = {status, "Q", "P", "F", "I", "C"};
    for(i=1;i<DayOfWeek.length();i++){
        if(DayOfWeek.get(i).equals(status)) {
            DayOfWeek.remove(DayOfWeek.get(i));
        }
    }

    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){

             }
         }
    });


    //create an ArrayAdaptar from the String Array
     ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
           R.layout.row, R.id.country, DayOfWeek);
     //set the view for the Drop down list

     spinner.setAdapter(adapter);
     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.
    }
}

This is my for loop:

  for(i=1;i<DayOfWeek.length();i++){
        if(DayOfWeek.get(i).equals(status)) {
            DayOfWeek.remove(DayOfWeek.get(i));
        }
  }

Here i got below error on for loop:
Cannot invoke length() on the array type
Cannot invoke get(int) on the array type
String[]

How can i remove this above error.please help me.
String[]

  • 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-13T00:34:14+00:00Added an answer on June 13, 2026 at 12:34 am

    Use:

    DayOfWeek.length // no function!
    

    and

    DayOfWeek[i] // operator []
    

    and read these documents:
    Java tutorial

    and by the way: You can’t remove items from an Array in Java. As @Gabriel said, maybe an ArrayList is better suited for your needs here.

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

Sidebar

Related Questions

Here i develop one android application and i have one image with size 197*253,
Hi i have to develop one expandablelistview android app.here i wish to create relativelayout
Hi i have to develop one spinner example. list is added on spinner box:
I have to develop one ExpandableListView. Here i wish to set the arrow icon
I have develop one application in which 3 activity. in first activity there are
i have try to develop one java app.here am getting information from mysql database.
I have sucessfully used Farseer to develop one of my game using XNA .
I have to develop an android view such that i have 2 spinner controls
i have develop one app in which five activity :: and sixth number activiy
I have develop one web site in php. I know how to upload it

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.