Code example for Spinner

Methods: getSelectedItemPosition

0
		adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinner.setAdapter(adapter);
	} 
 
	public void onClick(View view) {
		int position = spinner.getSelectedItemPosition();
		Intent intent = null;
		switch (position) {
		case 0: 
			intent = new Intent(Intent.ACTION_VIEW,
					Uri.parse("http://www.vogella.de"));
			break; 
		case 1: 
			intent = new Intent(Intent.ACTION_CALL,
					Uri.parse("tel:(+49)12345789"));
			break; 
		case 2: 
			intent = new Intent(Intent.ACTION_DIAL,
					Uri.parse("tel:(+49)12345789"));
			startActivity(intent);
Experience pair programming with AI  Get Codota for Java