ItemTouchHelper Class is not known by my Android studio

541 views Asked by At

i wanted to use the ItemTouchHelper Class, which should be available in the standard installation of android studio (so i wrote in the internet).

Anyhow i get an error message, when i try to use this class. You can see in picture. Error helper unknown

What can i do, to implement the necessary libary´s respectively the ItemTouchHelper Class.

Pls speak in easy words and describe so detailed as possible, because I am an absolute Android Beginner :)

I would be so glad about an solution!

Best Regards Fabian


Thank you both for your quick reply!

I added the appcompat line in my build.gradel file.

When building gradle i know get following error message: enter image description here

How can i fix this?

1

There are 1 answers

2
Navin Gupta On

check this link https://developer.android.com/reference/android/support/v7/widget/helper/ItemTouchHelper.html

Here ItemTouchHelper class extends RecyclerView.ItemDecoration implements RecyclerView.OnChildAttachStateChangeListener

so you should add these dependencies in your app's build.gradel file inside dependency block like this

compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'