On 25 sep, 16:57, Marco Nelissen <[email protected]> wrote:
> So there's your problem then, probably. The adapter expects each item
> to have the same items, so that it can assign the fields from your
> Cursor to the corresponding items in your list item layout. In other
> words, if your "normal" list item contains items with IDs A, B and C,
> them your "section" list items should also have items with IDs A, B
> and C, and those items should have the same type in both layouts as
> well.

So if i understand this good if have to use the same layout file for
my header file (that only needs a TextView) and my list item (with
much more information and many TextViews and a ImageView).

My list_header.xml file is like this:

<?xml version="1.0" encoding="UTF-8"?>
 <TextView

     xmlns:android="http://schemas.android.com/apk/res/android";
     android:id="@+id/list_header_title"
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     android:text="header"
     android:textColor="#FFFFFF"
     android:gravity="center_vertical|left"
        android:paddingLeft="20dip"

      android:background="@drawable/settings_header"
     android:textAppearance="?android:attr/textAppearanceSmall"
 />

I use this to set up a text for my heade. I use the
seperatedlistadapter from here:
http://jsharkey.org/blog/2008/08/18/separating-lists-with-headers-in-android-09/

>In your case, it looks like you have a TextView with a given ID
> in one layout, whereas in the other layout that same ID is either used
> for something that is not a TextView, or isn't present at all.

And I don't have a textview with the same ID.

> If you need some of the items in your list to be different between
> your "normal" and "section" layouts, then you should override bindView
> and handle that in there.

And how can i do that? I now use getView to make my list items in my
custom adapter and i only do this for my seperatedlistadapter:

adapter.addSection(parsed, new cinemaAdapter(this,
R.layout.list_header, cinema));

How can i use BindView then? I will give you my source code if you
want!
>
> On Thu, Sep 24, 2009 at 11:06 PM, Wouter <[email protected]> wrote:
>
> > Np the headers are using a separate layout file..
>
> > On 25 sep, 00:04, Marco Nelissen <[email protected]> wrote:
> >> On Thu, Sep 24, 2009 at 2:12 PM, Wouter <[email protected]> wrote:
>
> >> > On 24 sep, 22:53, Marco Nelissen <[email protected]> wrote:
> >> >> On Thu, Sep 24, 2009 at 1:41 PM, Wouter <[email protected]> wrote:
>
> >> >> > I have no problem with the data mapping and TextViews.
>
> >> >> The stack trace and crash you're seeing indicate otherwise.
> >> >> Unless you're doing something specific in bindView, the adapter
> >> >> expects each list item layout to be the same. You are overriding
> >> >> getView and returning different kinds of views, so I would take
> >> >> another look at that, and make sure that those two kinds of views are
> >> >> compatible.
>
> >> > Each list item layout is the same. it uses R.layout.cinema_row!
> >> > The weird is it makes my list with headers (when i use
> >> > seperatedlistadapter) and when i scroll down, it crashes and gives
> >> > this error.
> >> > Really will take a look at it, if not i will put my source code here!
>
> >> >> > It fully works
> >> >> > when i don't use a seperatedList adapter..
> >> >> > So there is problem with this seperatedListAdapter..
> >> >> > Is there another way i can use to divide my list in sections with
> >> >> > headers?
>
> >> >> I don't know what effect you're trying to achieve, but in general you
> >> >> can override bindView and/or getView to make each item look exactly
> >> >> the way you want.
>
> >> > I have a list of movies with a release date. all the movies with same
> >> > date has to be listed under a header with date.. And every list item
> >> > has same layout, really don't get it :(
>
> >> Every list item, including the header items? In other words: do your
> >> header items use the same layout as your other list items?
--~--~---------~--~----~------------~-------~--~----~
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