I need to get an dynamically added view position in LinearLayout with vertical orientation. For example i have 4 TextViews added dynamically on LinearLayout, then i need to
You can do it just like that
ViewGroup parent; int position; for(int i = 0; i < parent.getChildCount(); ++i) { int currentViewId = parent.getChildAt(i).getId(); if(currentViewId == wantendViewId) { position = i; } }
That's (in my opinion) the simplest way