String selection = (String) parent.getItemAtPosition(position);
int pos = -1;

for (int i = 0; i < clientName.size(); i++) {
if (clientName.get(i).equals(selection)) {
pos = i;
break;
}
}
System.out.println("Position " + pos); //check it now in Logcat

As Like

      autoCompleteTextView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long rowId) {
                String selection = (String) parent.getItemAtPosition(position);
                int pos = -1;

                for (int i = 0; i < clientName.size(); i++) {
                    if (clientName.get(i).equals(selection)) {
                        pos = i;
                        break;
                    }
                }
                System.out.println("Position " + pos); //check it now in Logcat


           

                    
});
}

Leave a Reply

Your email address will not be published. Required fields are marked *