Code example for AutoCompleteTextView

Methods: setAdaptersetOnItemClickListener

0
			 
			public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
				// TODO Auto-generated method stub 
				if(isChecked){
					AlertDialog.Builder builder = new AlertDialog.Builder(StorybookActivity.this);
					final AutoCompleteTextView edchoose = new AutoCompleteTextView(StorybookActivity.this);
					final ArrayAdapter<String> aa = new ArrayAdapter<String>(StorybookActivity.this, android.R.layout.simple_dropdown_item_1line, GetLocsFromDb());
					edchoose.setAdapter(aa);
					edchoose.setOnItemClickListener(new AdapterView.OnItemClickListener() {
 
						public void onItemClick(AdapterView<?> arg0, View arg1,
								int arg2, long arg3) {
							// TODO Auto-generated method stub 
							String selected = (String) aa.getItem(arg2);
							edchoose.setText(selected);
							 
							 
						} 
					}); 
 
					builder.setMessage("Inserisci la localit� da cercare");