Android Open Source - VoiceCart Custom On Item Selected Listener






From Project

Back to project page VoiceCart.

License

The source code is released under:

MIT License

If you think the Android project VoiceCart listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.example.VoiceCart;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.Toast;
/*from  w  ww  .ja  va2 s  .  co m*/
public class CustomOnItemSelectedListener implements OnItemSelectedListener {
 
    public void onItemSelected(AdapterView<?> parent, View view, int pos,
            long id) {
      Log.d("relevant item ",parent.getItemAtPosition(pos).toString() );
      if (parent.getItemAtPosition(pos).toString() == "Save") {
      }

         
        Toast.makeText(parent.getContext(), 
                "On Item Select : \n" + parent.getItemAtPosition(pos).toString(),
                Toast.LENGTH_LONG).show();
    }
 
    @Override
    public void onNothingSelected(AdapterView<?> arg0) {
        // TODO Auto-generated method stub
 
    }
 
}




Java Source Code List

com.example.VoiceCart.CustomOnItemSelectedListener.java
com.example.VoiceCart.MainActivity.java