Advertisement
Guest User

Untitled

a guest
Oct 15th, 2015
565
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.69 KB | None | 0 0
  1. import android.app.Activity;
  2. import android.view.View;
  3. import android.widget.AdapterView;
  4. import android.widget.Spinner;
  5. import android.widget.Toast;
  6.  
  7. public class SpinnerItemSelectedListener implements Spinner.OnItemSelectedListener {
  8.  
  9.     public Activity activity;
  10.  
  11.     public SpinnerItemSelectedListener(Activity activity) {
  12.         this.activity = activity;
  13.     }
  14.  
  15.     @Override
  16.     public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
  17.         Toast.makeText(activity, "Spinner: " + adapterView.getItemAtPosition(i).toString(), Toast.LENGTH_LONG).show();
  18.     }
  19.  
  20.     @Override
  21.     public void onNothingSelected(AdapterView<?> adapterView) {
  22.  
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement