This is the function:
public View getView(int position, View convertView, ViewGroup parent)
{
int sectionnum = 0;
for(Object section : this.sections.keySet()) {
Adapter adapter = sections.get(section);
int size = adapter.getCount() + 1;
// check if position inside this section
if(position == 0) return headers.getView(sectionnum,
convertView,
parent);
if(position < size) return adapter.getView(position - 1,
convertView, parent);
// otherwise jump into next section
position -= size;
sectionnum++;
}
return null;
}
93: --> if(position == 0) return headers.getView(sectionnum,
convertView, parent);
resource file:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ImageView android:id="@+id/imgCinema"
android:layout_width="60px"
android:layout_margin="5px"
android:src="@drawable/icon"
android:layout_height="80px">
</ImageView>
<LinearLayout
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="@+id/text1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="16px"
android:textStyle="bold"
android:text="FilmTitle"/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<RatingBar android:id="@+id/cinemarating"
style="?android:attr/ratingBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical" />
<TextView
android:id="@+id/votes"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="12px"
android:text="votes"/>
</LinearLayout>
<TextView
android:id="@+id/genre"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="12px"
android:text="genre"/>
<TextView
android:id="@+id/regisseur"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="12px"
android:text="regisseur"/>
<TextView
android:id="@+id/acteurs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="12px"
android:text="acteurs"/>
</LinearLayout>
</LinearLayout>
But without this seperatedlistadapter it is working (was working
before with it too). So don't know what problem is..
hope you can help me!
Wouter
On 18 sep, 18:41, "Yusuf Saib (T-Mobile USA)" <yusuf.s...@t-
Mobile.com> wrote:
> Where in your code is SeparatedListAdapter.java:93? And can you post
> the resource xml as well?
>
> Yusuf Saib
> Android
> ·T· · ·Mobile· stick together
> The views, opinions and statements in this email are those of the
> author solely in their individual capacity, and do not necessarily
> represent those of T-Mobile USA, Inc.
>
> On Sep 18, 7:16 am, Wouter <[email protected]> wrote:
>
> > I removed my seperatedlistadapter and now it worked.. :s But it was
> > working before with my seperatedlistadapter :(
>
> > On 18 sep, 14:47, Wouter <[email protected]> wrote:
>
> > > Really dont find what the problem is, the weird is it worked and i
> > > havent changed anything :(
>
> > > On 18 sep, 12:02, Wouter <[email protected]> wrote:
>
> > > > Hey,
>
> > > > I have a weird problem. For days i have a working list with movie
> > > > details i get from an xml rpc source. It loads the list very well and
> > > > I tried it again today and when i scroll down, always at the same list
> > > > item it gives me this error. I don't know what the problem is. It
> > > > shows my list items very good and now not anymore. If you want i can
> > > > give you my source code too! And it worked a few days ago and now
> > > > suddenty not :(
>
> > > > 09-18 11:50:00.940: ERROR/ArrayAdapter(1561): You must supply a
> > > > resource ID for a TextView
> > > > 09-18 11:50:00.950: DEBUG/AndroidRuntime(1561): Shutting down VM
> > > > 09-18 11:50:00.950: WARN/dalvikvm(1561): threadid=3: thread exiting
> > > > with uncaught exception (group=0x4001aa28)
> > > > 09-18 11:50:00.950: ERROR/AndroidRuntime(1561): Uncaught handler:
> > > > thread main exiting due to uncaught exception
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561):
> > > > java.lang.IllegalStateException: ArrayAdapter requires the resource ID
> > > > to be a TextView
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:
> > > > 347)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > android.widget.ArrayAdapter.getView(ArrayAdapter.java:323)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > com.android.moviemeter.SeparatedListAdapter.getView
> > > > (SeparatedListAdapter.java:93)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > android.widget.AbsListView.obtainView(AbsListView.java:1255)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > android.widget.ListView.addViewBelow(ListView.java:2795)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > android.widget.ListView.scrollListItemsBy(ListView.java:2725)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > android.widget.ListView.arrowScrollImpl(ListView.java:2225)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > android.widget.ListView.arrowScroll(ListView.java:2172)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > android.widget.ListView.commonKey(ListView.java:1977)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > android.widget.ListView.onKeyDown(ListView.java:1924)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > android.view.KeyEvent.dispatch(KeyEvent.java:893)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > android.view.View.dispatchKeyEvent(View.java:3647)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:744)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > android.widget.ListView.dispatchKeyEvent(ListView.java:1909)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:746)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:746)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > com.android.internal.policy.impl.PhoneWindow
> > > > $DecorView.superDispatchKeyEvent(PhoneWindow.java:1708)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > com.android.internal.policy.impl.PhoneWindow.superDispatchKeyEvent
> > > > (PhoneWindow.java:1197)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > android.app.Activity.dispatchKeyEvent(Activity.java:1967)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent
> > > > (PhoneWindow.java:1684)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:746)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:746)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:746)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > android.widget.TabHost.dispatchKeyEvent(TabHost.java:272)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:746)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:746)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > com.android.internal.policy.impl.PhoneWindow
> > > > $DecorView.superDispatchKeyEvent(PhoneWindow.java:1708)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > com.android.internal.policy.impl.PhoneWindow.superDispatchKeyEvent
> > > > (PhoneWindow.java:1197)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > android.app.Activity.dispatchKeyEvent(Activity.java:1967)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent
> > > > (PhoneWindow.java:1684)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > android.view.ViewRoot.deliverKeyEventToViewHierarchy(ViewRoot.java:
> > > > 2329)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > android.view.ViewRoot.handleFinishedEvent(ViewRoot.java:2299)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > android.view.ViewRoot.handleMessage(ViewRoot.java:1621)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > android.os.Handler.dispatchMessage(Handler.java:99)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > android.os.Looper.loop(Looper.java:123)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > android.app.ActivityThread.main(ActivityThread.java:4203)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > java.lang.reflect.Method.invokeNative(Native Method)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > java.lang.reflect.Method.invoke(Method.java:521)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
> > > > (ZygoteInit.java:791)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > dalvik.system.NativeStart.main(Native Method)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): Caused by:
> > > > java.lang.ClassCastException: android.widget.LinearLayout
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): at
> > > > android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:
> > > > 340)
> > > > 09-18 11:50:00.990: ERROR/AndroidRuntime(1561): ... 40 more
>
> > > > This is my cinemaAdapter class for making my list!
>
> > > > private class cinemaAdapter extends ArrayAdapter<FilmDetail> {
>
> > > > private List<FilmDetail> items;
>
> > > > public cinemaAdapter(Context context, List<FilmDetail> films)
> > > > {
> > > > super(context, R.layout.cinema_row, films);
> > > > this.items = films;
> > > > }
> > > > public View getView(int position, View convertView, ViewGroup
> > > > parent) {
> > > > View v = convertView;
> > > > FilmDetail o = items.get(position);
>
> > > > if (v == null) {
> > > > LayoutInflater vi = (LayoutInflater)
> > > > getSystemService(Context.LAYOUT_INFLATER_SERVICE);
> > > > v = vi.inflate(R.layout.cinema_row, null);
> > > > }
>
> > > > if (o != null) {
> > > > TextView tt = (TextView) v.findViewById
> > > > (R.id.text1);
> > > > TextView genre = (TextView) v.findViewById
> > > > (R.id.genre);
> > > > TextView directors = (TextView) v.findViewById
> > > > (R.id.regisseur);
> > > > TextView actors = (TextView) v.findViewById
> > > > (R.id.acteurs);
> > > > TextView votes = (TextView) v.findViewById
> > > > (R.id.votes);
> > > > ImageView imgCinema = (ImageView)
> > > > v.findViewById(R.id.imgCinema);
> > > > RatingBar cinemaRating = (RatingBar)
> > > > v.findViewById(R.id.cinemarating);
>
> > > > if (tt != null)
> > > > {
> > > > tt.setText(o.getTitle() + " (" + o.getYear
> > > > () + ")");
> > > > }
> > > > if (genre !=null)
> > > > {
> > > >
>
> ...
>
> meer lezen »
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---