You're a genius!  I pretty much did exactly what you said and it works
perfectly now!

BTW, I will be getting at least your Advanced Dev book, if not the
Tutorials book as well!

On Jul 8, 2:03 pm, Mark Murphy <[email protected]> wrote:
> Michael J wrote:
> > So I'm using a modified version of the SectionedAdapter and it seems
> > to be working quite well.  The only issue is that I want to let each
> > "section" adapter to determine the clickability of it's items.  It
> > seems like with the SectionedAdapter, all items except the headers are
> > clickable.  How exactly would I modify SectionedAdapter.isEnabled() to
> > use the corresponding section's isEnabled()?
>
> Off the cuff, I'd try:
>
> Step #1: Modify the Section inner class of SectionedAdapter to hold an
> isEnabled boolean, with an appropriate constructor parameter
>
> Step #2: Modify SectionedAdapter#addSection() to take an isEnabled
> boolean and pass it to the Section constructor
>
> Step #3: Modify SectionedAdapter#isEnabled() to do a logical AND between
> the current logic (getItemViewType(position)!=TYPE_SECTION_HEADER) and
> the Section's isEnabled flag, for whatever Section corresponds to the
> supplied position
>
> > I've spent time looking
> > at the methods used for getItem(), getViewType(), and getView() which
> > seem to do similar things, but honestly don't quite understand what's
> > being done...
>
> Well, um, it's, er, explained in the book. :-) And if you've read the
> chapter and still don't understand, then I need to do a better job on
> that chapter.
>
> Upshot: SectionedAdapter implements a variant of the Aggregator pattern.
> It implements the Adapter methods in such a way that the Section for a
> given position determines what happens (e.g., what View goes with a
> given position). Right now, isEnabled() only needs to worry about
> whether or not the position corresponds to a heading -- in what you want
> to do, you need to also see what the Section thinks.
>
> Also, bear in mind that it *is* just a book example, designed to
> demonstrate a technique (in concert with the book itself). Use of this
> code in a nuclear power plant or heart monitor -- let alone a
> nuclear-powered heart monitor -- is not recommended... ;-)
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Android App Developer Training:http://commonsware.com/training.html
--~--~---------~--~----~------------~-------~--~----~
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