Implementing 47degree android-swipelistview for swiping android ListViewItem
Asked Answered
T

4

10

Actually my goal is to implement a ListViewItem Swipe in android. I have tried it and stackoverflow has several examples which can make your ListViewSwipe. Examples.

Simple swipe gesture to activity tutorial?

Show button in a list view on swiping one item from that list

One point is there everyone is giving the code no one is explaining what is happening.

Then I asked question for it Android list view Right / Left swipes like call logs on which @CommonsWare have answered with SwipeListView library which has a smooth flow then the accepted answer. The accepted answer is also working fine I am presently using that only.

This is the library http://www.androidviews.net/2013/03/swipelistview/ Which provides you listview like this

enter image description here

I have tried more then 50 times to run the sample application provided on github here https://github.com/47deg/android-swipelistview-sample But everytime I am facing new problems. Presently the exception which is coming is

05-22 15:35:19.392: E/AndroidRuntime(980): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.fortysevendeg.android.swipelistview.SwipeListView" on path: /data/app/com.fortysevendeg.android.swipelistview-2.apk

I don't know what is happening I have checked the buildpath, libraries are also included asked so many people on stackoverflow chat But haven't got any help.

Actually on internet there is not a single tutorial for its implementation I have asked to so many peoples. So I want to know if someone have used this library please write an appropriate answer How to use it preporly So with me other future readers can also take the benefit out of it.

Or is there any other library to perform to implement this kind of functionality.

As @CommonsWare suggested. I have written an email to the author also to write an tutorial for using it.

Tribunal answered 22/5, 2013 at 10:35 Comment(13)
can you find out how to use it?I have similar problem and cant find out anything :(Gladdy
@Gladdy no I am not able to figure out till dateTribunal
I will email to the author ,I hope he answers :(Gladdy
@Gladdy I have emailed him around 25 days back but he haven't replied yet. If he replies to you please share the solution here. So that everyone can take the benefit out of it.Tribunal
I emailed him tonight but doesn't get any respond..I hope he respond me:(..Ok I will share the solution if I can find anything ;)Gladdy
Did you have seen this project?github.com/47deg/android-swipelistview-sampleGladdy
Anyone found a clue regarding swipelistview by 47deg. How to use it in our existing project.Cannula
@NikhilAgrawal Did you find anything regarding how to use swipe list view library.Terrier
@NidhiGondhia Sorry I haven't manage to find out the solution till date. If I got I will post it here.Tribunal
@NikhilAgrawal Okay,if you find any solution please do post here. Do you have any idea of similar library to implement swipe in list view.Terrier
@NidhiGondhia If you want o implement swipe listeners you can see my this post #16018488Tribunal
@all: i also faced the same problem and after 2 days conti. trying, i solved it. Instead of adding jar file, import folder "swipelistview" from pack and zip file as project in eclipse. in that prj, add lib "nineoldandroids-2.4.0" and "android.support.v4". Now in your own project, right click, select properties, add the above imported project as library. Thats it. Now it will work. Let me know if have any problem after this step. :)Nan
I have added a dynamic layout with n number of buttons in horizontal scroll view,after swipe on any side the horizontal scrollable buttons are visible in back layout,on click of the buttons visible it is working fine after scrolling the horizontal scroll view sometimes button click is working and sometimes it is not working.But that will work after again bringing back the front view started swiping action and again swipes to view the back view.Gossamer
A
12

Finally, I've managed to integrate Android-SwipeListView library by 47Degrees into my own application.

Works like a charm. Thanks to 47Degrees for writing such a wonderful piece of code.

Solution:

What doesn't work?!

Including JAR as dependency and attrs.xml in res/values OR referencing the SwipeListView library as a lib dependency in your project does not work.

What works?!

Include following classes in your application package. Be sure to correct the package names in these classes to your package name

  • SwipeListView.java
  • SwipeListViewListener.java
  • SwipeListViewListenerBase.java
  • SwipeListViewTouchListener.java

Include following xml into your application res/values folder

  • attrs.xml

Now you can define and use SwipeListView as follows

<au.com.your.package.SwipeListView
        xmlns:swipe="http://schemas.android.com/apk/res-auto"
        android:id="@+id/swipe_listview"
        android:listSelector="#00000000"
        android:layout_width="match_parent"
        android:layout_height="match_parent"        
        swipe:swipeFrontView="@+id/front"
        swipe:swipeBackView="@+id/back"
        swipe:swipeActionLeft="reveal"
        swipe:swipeActionRight="choice"
        swipe:swipeMode="both"
        swipe:swipeCloseAllItemsWhenMoveList="true"
        swipe:swipeOpenOnLongPress="true"
        swipe:swipeAnimationTime="100"
        swipe:swipeOffsetLeft="50dp"
        swipe:swipeDrawableChecked="@drawable/item_selected"
        swipe:swipeDrawableUnchecked="@drawable/item_unselected"
   />

Activity code you can use same as displayed in the example on SwipeListView github site.

You will need to correct some imports from the code above. In addition, you'll need to have NineOldAndroids by Jake Wharton included as a lib dependency in your project.

Athematic answered 17/11, 2013 at 22:59 Comment(1)
Thanks it helped. But Also requires nineoldandroids-2.4.0.jar for SwipeListViewTouchListener class, available in SwipeToDissmiss project at GitHub. We can download and add to our lib. folder of project and add to build path.Intergrade
T
2

The simplest test is to copy the whole thing inside your project. I see that it only has attr.xml in resources so it wont be that hard to do nor it will make your project dirty. Try that. Just copy/paste straight to /src

This should be a Android Library project and you should attach it as such. The bug you are having sometimes happens for some stupid reason which i don't know when you add libraries inside /libs (doesn't need referencing in BuildPath that way).

In this specific case this project will work only if you connect it as a library project, not a JAR.

Hope this helps.

Also this library is a Maven project. you need to have maven for android setup to be able to build it. or convert it back to a regular project.

Typhoid answered 22/5, 2013 at 11:13 Comment(2)
Sir can you please explain in some detail "In this specific case this project will work only if you connect it as a library project, not a JAR.". i WILL VERY GRATEFULT O YOU.Tribunal
Yes. So projects that have resources cannot be exported as a jar file and put into libs. They need to be connected as Library projects to your android app.developer.android.com/tools/projects/index.html. Its quite simple if you are using eclipse. just right click-properties -> android has everything you need to do.Typhoid
P
0

Try to add the following to build.grandle

repositories {
    mavenCentral()
    flatDir {
        dirs 'libs'
    }
    maven { url 'http://clinker.47deg.com/nexus/content/groups/public' }
}
Paresthesia answered 18/11, 2014 at 11:20 Comment(0)
C
0

I had this same problem.

java.lang.ClassNotFoundException: Didn't find class "com.fortysevendeg.android.swipelistview.SwipeListView"

To solve this you need import the library in Properties > Android > Library > Add... The solution of GDroid didn't work for me.

Tip 1: Copy the library to same workspace or folder of your project, the eclipse was with problem to import the project library in other folder. This post helped me to solve this problem: https://mcmap.net/q/93564/-in-eclipse-unable-to-reference-an-android-library-project-in-another-android-project

Tip 2: If you're looking for project library to ecplise, because the project to Android Studio does not works, then try open the project library in Android Studio, after finish the operations you must go at the project's folder and look for

gen-external-apklibs > com.fortysevendeg.android_swipelistview_1.0-20130701.103547-12

This is the folder with the project for eclipse. Import this project and then paste into the folder libs (if there isn't libs folder... create one) the

android-support-v4.jar and nineoldandroids-2.4.0.jar

These .jars should fix your errors.

Cinderella answered 20/11, 2014 at 20:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.