Wednesday 15 January 2014

java - Textview changing according to spinner and edittext with button click -


I'm trying to do is simple, I have a spinner in which certain items, Adittet and a button . I want to be able to select a fixed object with a spinner and then type a specific value and then click on a button I spinner item which is selected first by turning in a TextView the activity .

  public zeros submitButtonClick (see present) {spinner S1 = (spinner) findViewById (R.id.spinner1); Button B1 = (button) Find VVBIID (R.B. button2); If (b1.performClick ()) {switch () {}}}   

I have come up with so far, if I click on the B1 button, then start the following switch statement (If item 1 is selected, make sure, etc.) but I do not know how to achieve it. If someone could help, I would appreciate it. You

Thanks This is what I have to sum up now:

  public void Render (View v) {button B1 = (Button) findViewById (R.id.button2 ); Final Spinner S1 = (Spinner) Find VVBIID (RID Spinner 1); Final Reference Reference = This; b1.setOnClickListener (New View.OnClickListener () {@Override public void onClick (View v) {int status = s1.getSelectedItemPosition (); switch (status) {case 0: AlertDialog.Builder alertDialogBuilder = new AlertDialogkBuilder (reference) ; alertDialogBuilder.setTitle ( "warning"); alertDialogBuilder.setMessage ( "Please select an item from the list"); alertDialogBuilder.setPositiveButton ( "OK", the new DialogInterface.OnClickListener () {@Override public void onClick (DialogInterface dialogue, int id) {Bifrost.this.finish ();}}); AlertDialog spinnerError = alertDialogBuilder.create (); spinnerError.show (); break; case 1: break;}}}); }   

There is no error in the code and the app starts normally, but when I do I choose the first item and then click on the button, then nothing happens . Did I do something wrong in communicating?

You first need to onClickListener set your button, and select you spin this item Will have to achieve

  b1.setOnClickListener (New ViewkOnClickListener () {public void onClick (View v) {int status = s1.getSelectedItemPosition (); switch (status) {case 0: // The first item Brake; case 1: // second item break;}}});    

No comments:

Post a Comment