Are you doing this from onCreate?

On 03/10/2012 02:00 AM, RedBullet wrote:
And the answer is 0

On Friday, March 9, 2012 3:27:08 PM UTC-5, MagouyaWare wrote:

    What is the value of "index -
    getListView().getFirstVisiblePosition()"?

    Thanks,
    Justin Anderson
    MagouyaWare Developer
    http://sites.google.com/site/magouyaware
    <http://sites.google.com/site/magouyaware>


    On Fri, Mar 9, 2012 at 1:21 PM, RedBullet <> wrote:

        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

--
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