Sure.

This is my list view activity, including the adapter:

http://pastebin.com/MrD03Uv9

This is the "plain" list item layout:

http://pastebin.com/6fKWEkfc

And this is the layout that starts a new group, with the header:

http://pastebin.com/QMB12kWD

The code in the list adapter probably changes cursor position a little too often.

Although I don't think it should cause any significant performance degradation (it's all neighboring rows), one should be able to derive directly from BaseAdapter to get better control of position changes.

This should help get started:

http://www.netmite.com/android/mydroid/2.0/frameworks/base/core/java/android/widget/CursorAdapter.java

-- Kostya

15.11.2010 19:56, Thierry Legras пишет:
Could you please share the way you grab the previous row from within setViewValue? :)

2010/11/15 Kostya Vasilyev <kmans...@gmail.com <mailto:kmans...@gmail.com>>

    Ok, so I had a cursor-based ListView laying around, and decided to
    try and practice what I preach :)

    Got it working in just a few minutes, actually.

    The second screenshot shows that there aren't any issues with
    trackpad based selection highlighting, at least on my Motorola
    Milestone.

    To prevent clickable headers, I set an empty click listener just
    on the view that shows group data (the blue one).

    No crashes, either - I scrolled up and down quite a bit.

    http://img-fotki.yandex.ru/get/4700/kman.0/0_5bc24_c4d124db_L

    http://img-fotki.yandex.ru/get/4400/kman.0/0_5bc25_20348bcf_L

    -- Kostya

    15.11.2010 18:50, Neilz пишет:

        Interesting solution thanks , and I've kind of got it working very
        quickly. Unfortunately the headers are still clickable when
        visible
        (as they're part of a list item), so it's not as clean a
        solution as
        the MergeAdapter - if I can get that working!

        On Nov 15, 3:10 pm, Thierry Legras<tleg...@gmail.com
        <mailto:tleg...@gmail.com>>  wrote:

            Hi,

            I found something that highlights Kostya solution
            including a trick to avoir
            header to appear selected:

            
http://thebogles.com/blog/2010/02/section-headers-for-android-listviews/

            This seems straightforward to follow ... except that i
            can't get previous
            record. Unfortunately the isHeaderVisible(Cursor) method
            is not given :(
            I tried to use Cursor.moveToPrevious(), but that crashes
            on subsequent
            setViewValue call. I guessed I should not modify cursor within
            setViewValue() and try to restore cursor position before
            leaving the method,
            but that still crashes.
            Any clue?

            Thierry.

            2010/11/15 Neilz<neilhorn...@gmail.com
            <mailto:neilhorn...@gmail.com>>



-- Kostya Vasilyev -- WiFi Manager + pretty widget --
    http://kmansoft.wordpress.com


-- You received this message because you are subscribed to the Google
    Groups "Android Developers" group.
    To post to this group, send email to
    android-developers@googlegroups.com
    <mailto:android-developers@googlegroups.com>
    To unsubscribe from this group, send email to
    android-developers+unsubscr...@googlegroups.com
    <mailto:android-developers%2bunsubscr...@googlegroups.com>
    For more options, visit this group at
    http://groups.google.com/group/android-developers?hl=en




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


--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

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

Reply via email to