Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chris Banes' Android-PullToRefresh java.lang.NoSuchFieldError: com.handmark.pulltorefresh.library.R$id.pull_to_refresh_sub_text

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!

like image 254
Caten Avatar asked Jan 18 '26 01:01

Caten


1 Answers

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-auto

instead of the URI that includes the app package name. This URI is replaced with the app specific one at build time.

like image 86
Diego Torres Milano Avatar answered Jan 20 '26 17:01

Diego Torres Milano



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!