PullToRefreshListView Coming Up As Null On 3.1 Honeycomb Devices
kittcoldfire opened this issue · 4 comments
Hey there,
I'm using sections_list = (PullToRefreshListView)findViewById(android.R.id.list);
which is working perfectly on all devices I've tested it on with 2.1, 2.2, 2.3.x but I've just noticed that on devices running 3.x when trying to find the same id its returning null which is then crashing the app as there is no list to set the adapter too.
Is there another way to find this element? I've tried renaming it differently and it still returns null.
The XML looks like this for the element (and as I said it works fine on the other versions of android)
com.evolusent.lifestyler2.pulltorefresh.PullToRefreshListView
android:id="@+id/android:list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="0px"
android:layout_below="@id/contents_header"
android:scrollbars="none"
/>
It's intended to be used with an ListActivity
which would allow you to use (PullToRefreshListView) getListView()
on 3.x as well I believe.
but when trying to call that method "sections_list = (PullToRefreshListView) getListView();" I get the error
"java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'"
I changed the XML to have
<com.evolusent.lifestyler2.pulltorefresh.PullToRefreshListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="0px"
android:layout_below="@id/contents_header"
android:scrollbars="none"
/>
(this is the way developer.android has specified for declaring the layout)
and it is still not finding it
Hmm, can you reproduce this in the example app as well? Is it that you're using it with a ListFragment
then this post might be helpful, #30 (comment)
Closing this for now.