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

  • Home
  • SEARCH
  • 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 8426649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:35:14+00:00 2026-06-10T04:35:14+00:00

I wish to insert dropdown value in mysql database via soap webservice in android…if

  • 0

I wish to insert dropdown value in mysql database via soap webservice in android…if i have to change the dropdown value from my android app means that update value also save in mysql database…how is to do.please help me.

this is my webservice code:

public class Insertion {

public String insertData(String userName,String userPassword){

try{

 Class.forName("com.mysql.jdbc.Driver");
 Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/androidlogin","root","");
 PreparedStatement statement =  con.prepareStatement("INSERT INTO user(status) VALUES ('"+userName+"');");
 int result = statement.executeUpdate();
  }

   catch(Exception exc){
   System.out.println(exc.getMessage());
     }

   return "Insertion successfull!!";
     }

     }

this is my android code:

    public class InsertionExample extends Activity{
    private final String NAMESPACE = "http://ws.retailer.com";
private final String URL = "http://192.168.1.168:8085/Retailer/services/GetCurrentDateTime?wsdl";
private final String SOAP_ACTION = "http://ws.retailer.com/insertData";
private final String METHOD_NAME = "insertData";
Button btninsert;
private Spinner spnMusketeers;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);


    btninsert = (Button)findViewById(R.id.btn_insert);  
    btninsert.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
         insertValues();
        }
    });
}

public void insertValues(){
Spinner userName = (Spinner) findViewById(R.id.spnMusketeers);
    String user_Name = userName.getContext().toString();

 spnMusketeers = (Spinner) findViewById(R.id.spnMusketeers);
 List<String> lsMusketeers = new ArrayList<String>();
 lsMusketeers.add("Q");
 lsMusketeers.add("C");
 lsMusketeers.add("P");
 lsMusketeers.add("I");
 lsMusketeers.add("F");

 ArrayAdapter<String> aspnMusketeers = 
   new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, 
    lsMusketeers);
 aspnMusketeers.setDropDownViewResource
    (android.R.layout.simple_spinner_dropdown_item);
 spnMusketeers.setAdapter(aspnMusketeers);

  // Set up a callback for the spinner
   spnMusketeers.setOnItemSelectedListener(
 new OnItemSelectedListener() {
     public void onNothingSelected(AdapterView<?> arg0) { }

     public void onItemSelected(AdapterView<?> parent, View v, 
      int position, long id)  {
         SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
         PropertyInfo unameProp =new PropertyInfo();
         unameProp.setName("spnMusketeers");//Define the variable name in the web service method
         unameProp.setValue(status);//Define value for fname variable
         unameProp.setType(String.class);//Define the type of the variable
         request.addProperty(unameProp);//Pass properties to the variable



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

      } 
       // Code that does something when the Spinner value changes
     }
 });

  } 

  }

if i have to select the value from spinner after click the insert button means it is not inserted.the app is force closed…please review my code and give me correct solution for me.

  • 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-10T04:35:15+00:00Added an answer on June 10, 2026 at 4:35 am

    use below code for this insert function:

    String selectedItem = parent.getItemAtPosition(pos).toString();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wish to insert a Date value in DataRow[] and find a DateTime value
I wish to DELETE the data from a table before performing an INSERT INTO,
I wish to use sp_start_job to start a job from within an insert trigger
I have a table that I wish to update (or insert if no previous
I have a list of numbers between 1-20,000. I wish to insert all of
I have two databases on two different servers, i wish to insert the records
I have two dataframes and I wish to insert the values of one dataframe
in MATLAB i wish to insert a value half way between every element in
In my app I wish to save at some point an int value in
I have just finished developing an iPhone app and now I wish to make

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.