-2

I created a linear layout and adding dynamic views inside it, i want to get position of dynamic view inside linear layout when clicked, how can i do this

Thanks in advance!

S J
  • 426
  • 1
  • 7
  • 15
blackHawk
  • 6,047
  • 13
  • 57
  • 100

1 Answers1

0

Maybe I misunderstand the question, but why not to use indexOfChild method of ViewGroup ?

private int getViewIndex (ViewGroup viewGroup, View view)
{
    return viewGroup.indexOfChild(view);
}
Ayaz Alifov
  • 8,334
  • 4
  • 61
  • 56