1

I am trying to use both PullToRefresh and SwipeListView libraries in listview using PullToRefreshSwipeListView custom view class. I have implemented it like that:

First I have imported PullToRefresh library into my project then I have added a SwipeListView Jar File into PullToRefresh library projet by making a libs folder in it. Then I have added PullToRefreshSwipeListView class in the src folder(com.handmark.pulltorefresh.library) of PullToRefresh library project. Finally I am trying to implement this custom class PullToRefreshSwipeListView into my project's xml as:

<com.handmark.pulltorefresh.library.PullToRefreshListView
    xmlns:swipe="http://schemas.android.com/apk/res-auto"
    xmlns:ptr="http://schemas.android.com/apk/res-auto"
    android:id="@+id/lv_Inbox"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:cacheColorHint="#00000000"
    android:divider="#19000000"
    android:dividerHeight="2dp"
    android:fadingEdge="none"
    android:fastScrollEnabled="false"
    android:footerDividersEnabled="false"
    android:headerDividersEnabled="false"
    android:scrollbars="none"
    android:smoothScrollbar="true"
    ptr:ptrAnimationStyle="flip" >

    <libs.swipelistview.SwipeListView
        android:id="@+id/users_list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:cacheColorHint="#0000"
        android:clipToPadding="false"
        android:divider="@null"
        android:dividerHeight="0px"
        android:fadingEdge="none"
        android:scrollbarStyle="outsideOverlay"
        swipe:swipeActionLeft="reveal" />
</com.handmark.pulltorefresh.library.PullToRefreshListView>

But I am getting error in xml as:

  • error: No resource identifier found for attribute 'swipeActionLeft' in package
  • error: No resource identifier found for attribute 'swipeActionLeft' in package
  • error: No resource identifier found for attribute 'swipeMode' in package

It does not get any of the swipe attribute but If I remove swipe attributes. It is working fine for only PullToRefresh. I am following this link to implement it. Any Solution/Comments will be most appreciated.

Nouman Bhatti
  • 1,777
  • 4
  • 28
  • 55
  • there is no need to use external libraries. You use swipe refresh layout and android swipe list item natively. https://developer.android.com/reference/android/support/v4/widget/SwipeRefreshLayout.html and swipe example http://stackoverflow.com/questions/17857775/android-listview-row-delete-animation – Raghunandan Aug 26 '14 at 11:01
  • No, you can not compare SwipeRefreshLayout with PullToRefresh. Android support library class SwipeRefreshLayout does not provide way to add action bar hint "Pull to refresh". – Yuraj Aug 26 '14 at 11:14
  • Have you get an perfect ans for this? I have also same problem. I am not get any proper solution...How can I do this? – Chirag Savsani Mar 18 '15 at 15:48

2 Answers2

1
better you go with 
swiperefresh layout

https://developer.android.com/reference/android/support/v4/widget/SwipeRefreshLayout.html
krunal patel
  • 2,369
  • 1
  • 11
  • 11
  • I want flip effect when user pulltorefresh like Facebook Android app. SwipeRefreshLayout provides Gmail like effect when pulltorefresh. Also SwipeRefreshLayout is only for vertical swipe gesture. I am trying to implement here horizontal swipe on list item. So even if I implement SwipeRefreshLayout I have to implement SwipeListView library. And the problem remains there – Nouman Bhatti Aug 13 '14 at 07:04
1

Why are you trying to merge PullToRefresh into SwipeListView library ? I have used PullToRefresh with SwipeListView without no problems (just imported using gradle not JARs).

You are getting these errors because you have not copied swipelistview__attrs.xml from res/values in SwipeListView library (this file)

Yuraj
  • 3,185
  • 1
  • 23
  • 42
  • I am working on Eclipse not Android studio cant use gradle. Thats why I am using jar file of swipelistview – Nouman Bhatti Aug 26 '14 at 10:17
  • Have you tried copying swipelistview__attrs.xml file into project/pulltorefresh? – Yuraj Aug 26 '14 at 10:23
  • How are you using PullToRefresh with SwipeListView? Can you post some code here. I think there is need to add custom ListView item in xml file for both PullToRefresh and SwipeListView libraries. PullToRefresh adds it like – Nouman Bhatti Aug 26 '14 at 10:24
  • Ok I did change my code according to link you have provided. I have edited the code in my question description. I have separated two libraries now and added in to my project separately. Now I am not getting any error in XML. But how to use both of them in Java code? As both PullToRefresh and SwipeRefresh returns the listview object in code. How to use them. Should I make objects of both seperatly but then i would have two listviews? Please tell me how you did in you code? Thanks – Nouman Bhatti Aug 26 '14 at 11:03
  • PullToRefreshLayout is not ListView. You must make your Activity or Fragment implements OnRefreshListener. In onCreateView or OnCreate add these lines: mPullToRefreshLayout = (PullToRefreshLayout) view.findViewById(R.id.pull_refresh); ActionBarPullToRefresh.from(getActivity()).allChildrenArePullable().listener(this).setup(mPullToRefreshLayout); – Yuraj Aug 26 '14 at 11:09
  • I am getting crash in while importing library into my project. So following http://stackoverflow.com/questions/19848610/need-help-to-implement-47degree-android-swipelistview I copied all Java classes into my project by creating a package. And then tried to access it into xml but still getting crash. java.lang.RuntimeException: Unable to start activity ComponentInfo{com.whizpool.xyc/com.xyc.DashBoardActivity}: android.view.InflateException: Binary XML file line #23: Error inflating class libs.swipelistview.SwipeListView – Nouman Bhatti Aug 26 '14 at 12:33
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/60007/discussion-between-nouman-bhatti-and-yuraj). – Nouman Bhatti Aug 26 '14 at 12:34