OK, so here is my code snipet:

RouteAdapter adapter = new RouteAdapter(this, route.getCues());
setListAdapter(adapter);
setSelection();
    }
    
    public void setSelection()
    {
    RouteAdapter adapter = (RouteAdapter) getListAdapter();
    Integer index = adapter.getPosition(nextCuePoint);
    View itemView = this.getListView().getChildAt(index - 
getListView().getFirstVisiblePosition());

The position of the nextCuePoint is 0 (which is correct since it is the 
first cue). But I am getting null for itemView...


On Friday, March 9, 2012 3:11:21 PM UTC-5, Kostya Vasilyev wrote:
>
> The children are always numbered starting at 0.
>
> The top position may correspond to, erm, 1812'th adapter item, and still 
> be the zero'th child.
>
>          int nFirst = mAccountListView.getFirstVisiblePosition();
>          int nLast = mAccountListView.getLastVisiblePosition();
>          for (int position = nFirst; position <= nLast; ++position) {
>              View itemView = mAccountListView.getChildAt(position - 
> nFirst);
> ...
>
>
> On 03/10/2012 12:03 AM, RedBullet wrote:
> > Really?
> >
> > So, if I have 100 items in my ListView, and I want to be monkeying 
> > around with item #50 I would do:
> > getListView().getChild(getListView().getFirstVisiblePosition() - 50)) ?
> >
> > that doesn't seem right...
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to