there i am trying to write code for authorisation activity. When i am putting some entry in inputEmail i expect that my inputPasword will be fileed automaticly if corresponding record exists. However onItemSelectedListener seemd not to work. When i select item nothing happens. Log does not fiers to. I'd like to know if i made some mistake or i am going in wrong aproach.
AutoCompleteTextView inputEmail; inputEmail = (AutoCompleteTextView) findViewById(R.id.loginEmail); inputEmail.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Set<String> keys = prefs.getAll().keySet(); emails.clear(); if (keys.size() != 0) { emails.addAll(keys); } else emails.add(""); inputEmail.setAdapter(adapter); email = inputEmail.getText().toString(); } }); inputEmail.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { // TODO Auto-generated method stub email = inputEmail.getText().toString(); password = prefs.getString(email, ""); Log.d(email + " "+password, "email+password"); if (password.length() > 1) { inputPassword.setText(password); } } @Override public void onNothingSelected(AdapterView<?> arg0) { // TODO Auto-generated method stub } });