1. Are you ready for the Galaxy S20? Here is everything we know so far!

Apps edittext has to go enable from disable after select the particular item in the list of spinner

Discussion in 'Android Development' started by ezhil, Feb 11, 2011.

  1. ezhil

    ezhil Lurker
    Thread Starter

    hi every one,

    My code:

    Code (Text):
    1.      
    2.  
    3.      String[] Items = {
    4.                 "Alarm",
    5.                 "Office",
    6.                 "Meeting",
    7.                 "Party",
    8.                 "Lunch",
    9.                 "Breakfast",
    10.                 "Supper",
    11.                 "Home",
    12.                 "Private",
    13.                 "Outdoor",
    14.                 "Family",
    15.                 "Friends",
    16.                 "Others"
    17.         };
    18.      
    19.         Spinner s1;  
    20.  
    21.  
    and
    Code (Text):
    1.  
    2.        
    3.         s1 = (Spinner) findViewById(R.id.spinner);
    4.        
    5.         ArrayAdapter<String> adapter  = new ArrayAdapter<String>(
    6.                 this,
    7.                 android.R.layout.simple_spinner_dropdown_item,
    8.                 Items);
    9.  
    10.         s1.setAdapter(adapter);
    11.         s1.setOnItemSelectedListener(new OnItemSelectedListener()
    12.         {
    13.             public void onItemSelected(AdapterView<?> arg0,
    14.             View arg1, int arg2, long arg3)
    15.             {
    16.                 int index = s1.getSelectedItemPosition();
    17.                 Toast.makeText(getBaseContext(),
    18.                     "You have selected item : " + Items[index],
    19.                     Toast.LENGTH_SHORT).show();                
    20.             }
    21.  
    22.             public void onNothingSelected(AdapterView<?> arg0) {}
    23.         });
    24.  

    In it if i select the item "others" in the spinner.... the edittext has to go enable otherwise it ll be a disable.the same the edittext to get item to add spinner...

    any one can help me thank you
     

    Advertisement

Loading...
Similar Threads - edittext has enable
  1. Android News
    Replies:
    0
    Views:
    75
  2. Android News
    Replies:
    0
    Views:
    11
  3. Android News
    Replies:
    0
    Views:
    8
  4. bridex
    Replies:
    2
    Views:
    151
  5. Android News
    Replies:
    0
    Views:
    4
  6. Gourav Sarker
    Replies:
    1
    Views:
    228
  7. isaacstetski
    Replies:
    0
    Views:
    87
  8. Jazaddict62
    Replies:
    0
    Views:
    226
  9. FSchmidt
    Replies:
    9
    Views:
    3,075
  10. 3plconnor
    Replies:
    3
    Views:
    438

Share This Page

Loading...