I’m trying to use https://github.com/chrisbanes/Android-PullToRefresh/. I followed the example but got the error
java.lang.NoSuchFieldError: com.handmark.pulltorefresh.library.R$id.pull_to_refresh_sub_text
This is my grid:
<com.handmark.pulltorefresh.library.PullToRefreshGridView
xmlns:ptr="http://schemas.android.com/apk/res/com.abc.myproject"
android:id="@+id/gv_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:listSelector="#00000000"
android:padding="4dp"
android:horizontalSpacing="4dp"
android:verticalSpacing="4dp"
android:gravity="center"
android:numColumns="3"
android:columnWidth="128px"
android:stretchMode="columnWidth"
ptr:ptrMode="pullDownFromTop"
ptr:ptrDrawable="@drawable/android" />
When I run I have the above exception. I added the PullToRefresh as another project in the workspace and make it my project’s library. I also added the Jar file. I think the error is because the line
xmlns:ptr=”http://schemas.android.com/apk/res/com.abc.myproject”?
I traced the code and the line that caused the exception is in LoadingLayout.java:
mSubHeaderText = (TextView) header.findViewById(R.id.pull_to_refresh_sub_text);
Am I doing something wrong?
Thanks!
Android SDK Tools r17 adds support for custom views with custom attributes in libraries. Layouts using custom attributes must use the namespace URI:
http://schemas.android.com/apk/res-autoinstead of the URI that includes the app package name. This URI is replaced with the app specific one at build time.