0
String [] strinArray={"A","B,"c","D"};
AlertDialog.Builder builder = new AlertDialog.Builder(activity);

        @Override

        public void onClick(final DialogInterface dialog, final int item) {

          String value = stringArray[item];


       }

String [] strinArray={"A","B,"c","D"};
AlertDialog.Builder builder = new AlertDialog.Builder(activity);

        @Override

        public void onClick(final DialogInterface dialog, final int item) {

          String value = stringArray[item];


       }

I want to get Position of item what I have selected ?

Nikunj Paradva
  • 15,332
  • 5
  • 54
  • 65

1 Answers1

0

set for loop and get position of string ;-

for (int i = 0; i < strinArray.length; i++) {
            if(strinArray[i].equals("A")){
               log.d("LOG", "Position of A is "+i);
                 }

        }

i is the position of your string;

Sandeep Malik
  • 1,972
  • 1
  • 8
  • 17