Drag and drop Reorder in Recycler View | Android

  Рет қаралды 31,912

Mafia Codes

Mafia Codes

4 жыл бұрын

In this video you will learn how to handle #drag and drop reordering inside a recycler view.
⭐ Kite is a free AI-powered coding assistant that will help you code faster and smarter. The Kite plugin integrates with all the top editors and IDEs to give you smart completions and documentation while you’re typing. I've been using Kite for 6 months and I love it! www.kite.com/get-kite/?...
FREE $100 credit @Digital Ocean: m.do.co/c/3208f08b3324
Patreon: / trulymittal
Subscribe: kzfaq.info...
#RecyclerView (Basic Setup): • Recycler View with com...
Pull to Refresh Recycler View: • Pull to Refresh in Rec...
Swipe gestures Recycler View: • Swipe gestures in Recy...
Github(Tutorial): github.com/trulymittal/Recycl...
RecyclerView: developer.android.com/guide/t...
RecyclerView(dependency): developer.android.com/guide/t...
---------------
More useful videos
---------------
#ViewModel: • View Model | Live Data...
#Retrofit: • RETROFIT Tutorial (v 2...
#WorkManager: • Work Manager | Android...
#KeyframeAnimations: • Keyframe Animations wi...
#CollapsingToolbar Layout: • Collapsing Toolbar Lay...
#BottomNavigation View: • Bottom Navigation View...
#NavigationComponent: • Navigation Component |...
#NightMode: • Night Mode | Dark Mode...
#ButterKnife: • Butter Knife | Field a...
SplashScreen: • Splash screen | Launch...
Singletons: • Singletons | What When...
---------------
What I use
---------------
Mouse: amzn.to/2O9RJtu
Keyboard: amzn.to/2qxajCU
Keyboard 2: amzn.to/2XDWH4X
Monitor: amzn.to/2pDg7dH
Processor: amzn.to/347WWIb
RAM: amzn.to/2QEkUqw
Graphics: amzn.to/33aBrF4
Microphone: amzn.to/2DabdI9
#yoursTruly #tutorial #how-to #android

Пікірлер: 110
@user-qp2mx3hy5g
@user-qp2mx3hy5g 4 жыл бұрын
Thanks a lot! Short, simple, working and exactly what I was searching for.
@mafiacodes
@mafiacodes 4 жыл бұрын
Subscribe like share😊
@mohammadnoorhossain126
@mohammadnoorhossain126 Жыл бұрын
Thanks a lot! Short, simple, working and exactly what I was searching And Struggle For eight hours !
@samstoyroom
@samstoyroom 4 жыл бұрын
Amazing tutorial, just what I need! Thank you so much.
@mafiacodes
@mafiacodes 4 жыл бұрын
Subscribe like share 😊
@hissabis2068
@hissabis2068 3 жыл бұрын
Thank you so much bro, you do a great job. I follow you continuously.
@user-ni9cn2ff9o
@user-ni9cn2ff9o 3 жыл бұрын
thanks for your simple and clear tutorial!!
@waddahmustafa2954
@waddahmustafa2954 3 жыл бұрын
Wow man this is simple and works as magic. Thanks
@luiizfiilhoo
@luiizfiilhoo 4 жыл бұрын
Thank you bro, thats exactly what i need.
@afterhelloworld4476
@afterhelloworld4476 4 жыл бұрын
Great video. Explained everything to the point. Thanks
@mafiacodes
@mafiacodes 4 жыл бұрын
Subscribe like share
@georgeanderson9625
@georgeanderson9625 4 жыл бұрын
Thank you very much for this tutorial.
@jagadishlakkur191
@jagadishlakkur191 4 жыл бұрын
best tutorials ever
@tresormvumbi
@tresormvumbi 4 жыл бұрын
Thanks a lot dude for this nice tutorial, it worked great!
@mafiacodes
@mafiacodes 4 жыл бұрын
Subscribe like share😊
@d-news4076
@d-news4076 2 жыл бұрын
Thank you, helped!
@gamelogger5233
@gamelogger5233 2 жыл бұрын
thank you for this short and very useful vidoe
@RandomGuy-df1oy
@RandomGuy-df1oy 3 жыл бұрын
Great explanation mate
@DoubleNation
@DoubleNation 4 жыл бұрын
Really nice tutorial, you got a new sub!
@mafiacodes
@mafiacodes 4 жыл бұрын
😊
@somechazz_y
@somechazz_y 4 жыл бұрын
man, this was such a nice thorough explanation, thanks a lot, you have me curious about the source of that noise tho lol
@alfredzr
@alfredzr Жыл бұрын
Pressure cooker lol. A common vessel in Indian cooking. Goes to show he made this tutorial while waiting for his rice or curry to cook
@manashharshvardhan5007
@manashharshvardhan5007 3 жыл бұрын
Mogambo khush hua...😎 Aur apoko 1 new subscriber mil gya
@intelligentcoding689
@intelligentcoding689 3 жыл бұрын
Very helpful, thanks
@Julian-rx1ob
@Julian-rx1ob 4 жыл бұрын
great tutorial! ty so much dude:)
@mafiacodes
@mafiacodes 4 жыл бұрын
Subscribe like share
@sourcecode6467
@sourcecode6467 2 жыл бұрын
Excellent tutorial, very well explained and demonstrated. Thanks. Love from England ❤️
@mafiacodes
@mafiacodes 2 жыл бұрын
Subscribe like share
@sourcecode6467
@sourcecode6467 2 жыл бұрын
@@mafiacodes I liked and subscribed, I don't have anyone to share too 😂
@mafiacodes
@mafiacodes 2 жыл бұрын
😅
@sourcecode6467
@sourcecode6467 2 жыл бұрын
@@mafiacodes are all of your Android tutorials in Java ? Have you shifted to Kotlin ?
@starship9874
@starship9874 3 жыл бұрын
Awesome tutorial
@dimitrikravtsov4798
@dimitrikravtsov4798 2 жыл бұрын
Really helpful!
@yongkymartindo3343
@yongkymartindo3343 2 жыл бұрын
still relevant in 2021 thanks..
@yongkymartindo3343
@yongkymartindo3343 2 жыл бұрын
but, how to get latest position of all array, after rearange the playlist ?
@ejazrahim6349
@ejazrahim6349 4 жыл бұрын
sir u have the one of the best android lectrs, i have seen your recyclerview and it was somuch easy to understand , kindly expain data base and broadcast recievers plz thanks
@mafiacodes
@mafiacodes 4 жыл бұрын
Thanks, I have a playlist for Room Database, you can watch that. kzfaq.info/sun/PLdHg5T0SNpN3CMNtsd5KGaiBtzhTGIwtC
@ejazrahim6349
@ejazrahim6349 4 жыл бұрын
@@mafiacodes ok sir plz do on broadcasts
@vinitgrover360
@vinitgrover360 Жыл бұрын
Thanks
@yrrag
@yrrag 3 жыл бұрын
Awesome!
@user-et6vx6ri5h
@user-et6vx6ri5h Жыл бұрын
thx
@LaOdeMuhArmadiAM
@LaOdeMuhArmadiAM 4 жыл бұрын
Thank's brother
@mafiacodes
@mafiacodes 4 жыл бұрын
Subscribe like share
@AmitJayant
@AmitJayant 3 жыл бұрын
5:14 Pressure cooker :D
@analogsound
@analogsound 2 жыл бұрын
You have a good keyboard :-)
@internettime9309
@internettime9309 4 жыл бұрын
Thanks for the help but how to change the position in database as well?
@cancihancelebi3495
@cancihancelebi3495 3 жыл бұрын
Thank you, how will the settings stay?
@itsgauravparmar
@itsgauravparmar 2 жыл бұрын
@yourtruly there is a position like 0,1,2,3,4,5 on the listing. Can you suggest to me how I can update that position as well?
@lglf77
@lglf77 2 жыл бұрын
And SQLite record position of this RecyclerView, i not searching video in you tube? with use of the onLongClickListener?
@Dhruvbala
@Dhruvbala 4 жыл бұрын
Nice pressure cooker
@mehulbisht9708
@mehulbisht9708 4 жыл бұрын
😂😂😂😂
@WesleyFranks
@WesleyFranks 4 жыл бұрын
can you do a video on this, but change the background color of the item that is being dragged?
@sorinaion1365
@sorinaion1365 4 жыл бұрын
Really great tutorial ! Thank you ! One question please - in the onMove method, the return value was "false". Why ? I tried to replase the "false" to "true", but nothing changed in the functionality. What is the purpose of that boolean "return" value, since nothing is changed based on that value ? Thank you !
@mafiacodes
@mafiacodes 4 жыл бұрын
You should return TRUE, its like telling the touch helper that the move was handled.
@nikkieloves
@nikkieloves 4 жыл бұрын
Fabulous tutorial! Is there a way to add unique buttons to each line of the recyclerview?
@mafiacodes
@mafiacodes 4 жыл бұрын
Probably you want is this Multi view RecyclerView | getItemViewType() | Android kzfaq.info/get/bejne/jNqef9N5utuWhWQ.html OR depending on the row you can change the button title dynamically. Subscribe like share😊
@lglf77
@lglf77 2 жыл бұрын
Congratulations on the content, but if I quit sort a list down, if I quit the activity, is the reordering saved? I don't think so, I never see these videos in their entirety. What to do to try to follow your channel, will you complete the rest of the video?
@SumitSingh-df7gg
@SumitSingh-df7gg Жыл бұрын
Can you please help , in Drag and Drop for child items having different sizes. I am using StaggeredGridLayoutManager. Drag and Drop is working fine. But during Drag of Big items leads to Items duplication in RecyclerView background.
@vijay6877
@vijay6877 4 жыл бұрын
Your video is helped me in achieving the functionality but I want you to please explain a bit more about the classess you use. I mean I don't know what is item touch helper is and how can I modify it according to my convenience. PS: Sorry for the grammatical mistakes.
@mafiacodes
@mafiacodes 4 жыл бұрын
I'll try to make a video for the same sometime sooner.
@mehulpanchal7539
@mehulpanchal7539 4 жыл бұрын
TYSOOM :)
@mafiacodes
@mafiacodes 4 жыл бұрын
subscribe like share....
@4ytonly
@4ytonly 4 жыл бұрын
Is there a way to do this without long press, but just with touch and drag? I would like to insert an image, a handle so user can touch on that handle and drag instead of touch and hold for drag?
@martinh3729
@martinh3729 4 жыл бұрын
I'm looking for this as well. Other options seem rather complicated.
@kauanmatos1632
@kauanmatos1632 3 жыл бұрын
Portuguese legends, please!!!
@Info-dj7qs
@Info-dj7qs 3 жыл бұрын
Sir , how i can change the color of view only for moving time and then back to normal. i have mini. target device is 19 so please give me solution.
@demstheprogrammer
@demstheprogrammer 5 ай бұрын
but how to make is automatically changed the index after the swap
@empiregood9225
@empiregood9225 2 жыл бұрын
And SharefPreference in Drag in Drog of the RecyclerView?
@denialfian2122
@denialfian2122 4 жыл бұрын
im dying with that noise :v
@pronavsandhu
@pronavsandhu 4 жыл бұрын
very nice bro, can you please tell me if you know how to drag an item into folder?
@hemantpatel5118
@hemantpatel5118 3 жыл бұрын
great man! ❤ but I want to drag and drop by touch any button of recyclerview item instead of Long press . please help :(
@jatinchopra1621
@jatinchopra1621 4 жыл бұрын
Why does my RecyclerView with ItemTouchHelper stop dragging after only one item
@jatinchopra1621
@jatinchopra1621 4 жыл бұрын
i fixed it by deleting this method in my recycle view adapter @Override public int getItemViewType(int position) { return position; }
@Devlyashov
@Devlyashov 4 жыл бұрын
@@jatinchopra1621 Man, you are awesome! I solving this problem for more than two days and only you helped me! Thank you very much!
@vamsi1871
@vamsi1871 4 жыл бұрын
Plz teach me pagination adapter in recycler view
@user-lh4dd4of4s
@user-lh4dd4of4s Жыл бұрын
hi i am getting error " java.lang.IndexOutOfBoundsException: Index: 5, Size: 0" on collections.swap. my data is from firestore. can u help me?
@giddyshow6718
@giddyshow6718 Жыл бұрын
*Как мне двигать кнопки в LinearLayout?*
@LaOdeMuhArmadiAM
@LaOdeMuhArmadiAM 4 жыл бұрын
it's running in my app
@guidobertelli7337
@guidobertelli7337 Жыл бұрын
Hello, thanks for the great video but unfortunately it solved just an half of my problem. My recViews are connected to a realtime Firebase Database and I would like to implement the changes in position (swapping) also in the database so that those changes are then kind of permanent and they do not disappear when I exit the activity. Thanks in advance for your help and God bless u
@guidobertelli7337
@guidobertelli7337 Жыл бұрын
The order of keys that you see in the console is fixed. It's just the lexicographic (alphabetical) ordering of the keys. There is no "move" operation for child keys. If you want the children to be ordered, put some child value under each of them that you can use in a query to order them.
@mafiacodes
@mafiacodes Жыл бұрын
Thank you, that you have to do manually by triggering a call to firebase api. Afaik.
@guidobertelli7337
@guidobertelli7337 Жыл бұрын
I found this answer on stackoverflow and it looks promising
@algernonanon4533
@algernonanon4533 4 жыл бұрын
is there a way to add a hide/unhide icon on drag view?
@mafiacodes
@mafiacodes 4 жыл бұрын
Use on drag start drag end to hide and show
@jeet198
@jeet198 3 жыл бұрын
But After App close , items go to the initial position.. How to solve this this?
@Iraqistudent
@Iraqistudent Жыл бұрын
🌹🌹🌹
@jeet198
@jeet198 3 жыл бұрын
Is it possible to save their position after changing order, even after closing the app remains same.
@mafiacodes
@mafiacodes 3 жыл бұрын
Need to create a field in ur db and then change sort order there after sortint
@jeet198
@jeet198 3 жыл бұрын
@@mafiacodes can you make a video for that?
@luciarudiak5027
@luciarudiak5027 4 жыл бұрын
How to capture fromPosition and id to post?
@mafiacodes
@mafiacodes 4 жыл бұрын
Watch @ 4:45 to know how to get from and to position
@michaelschroder7186
@michaelschroder7186 4 жыл бұрын
Many thanks for the tutorial. I tried to follow your instructions. Unfortunately the drag and drop doesn't work. As soon as I click on the button longer, the entry is not moved but deleted. Do you have an idea what I am doing wrong?
@mafiacodes
@mafiacodes 4 жыл бұрын
Seems that u have added a long click listener on ur items and that I called before drag could work, if possible share ur code on github so I can see what’s happening
@michaelschroder7186
@michaelschroder7186 4 жыл бұрын
@@mafiacodes I have tried to put put the Code to GIT. Hope you have access to my "MainActivity!" File.
@mafiacodes
@mafiacodes 4 жыл бұрын
Send me the link
@michaelschroder7186
@michaelschroder7186 4 жыл бұрын
@@mafiacodes github.com/SoftwareBaschtler/recyclerView_V01.git
@michaelschroder7186
@michaelschroder7186 4 жыл бұрын
@@mafiacodes Does the link work? Could you read the file?
@menahemamar4491
@menahemamar4491 Жыл бұрын
The SWAP operation is not correct. Let's say I have a list of 3 elements [A,B,C] and the user moved the item from position 2 (C) to position 0 very quickly that the onMove() method was called *only once* when fromPosition=2 and toPosition=0 (It happened to me) then the updated list should be [C,A,B] and not [C,B,A] as the SWAP operation does
@pranavpratapsingh6002
@pranavpratapsingh6002 3 жыл бұрын
Sir, it is only working to rearranging names , if we use different icons for each movie(or other information) then this won't work for their icon(or other information) ,anyway i resolved it , but you should mention it in video too......anyway thanks...
@moazzahran313
@moazzahran313 3 жыл бұрын
how did you resolve it?
@pranavpratapsingh6002
@pranavpratapsingh6002 3 жыл бұрын
@@moazzahran313 in this tutorial they only took , list of name .If u are using with list of icons(or many extra things) then just use all the list along with name lists(like in swap function) ,I can more clear it , Watsapp me at 7897570695...if u are interested 😄
@vijaysathvikab5866
@vijaysathvikab5866 4 жыл бұрын
how to do this for only card views
@mafiacodes
@mafiacodes 4 жыл бұрын
U mean without recycler view
@vijaysathvikab5866
@vijaysathvikab5866 4 жыл бұрын
@@mafiacodes yes,Only for cardviews inside a fragment.Can we do it?if yes,please do a video
@mafiacodes
@mafiacodes 4 жыл бұрын
This method is for recycler view
@vijaysathvikab5866
@vijaysathvikab5866 4 жыл бұрын
@@mafiacodes yes,but can we do it for card view only?
@mohammedalsadoon8444
@mohammedalsadoon8444 2 жыл бұрын
Thanks a lot! Short, simple, working and exactly what I was searching for.
Filter RecyclerView using Search View | Android
11:54
Mafia Codes
Рет қаралды 117 М.
RecyclerView | Everything You Need to Know
25:07
Practical Coding
Рет қаралды 130 М.
KINDNESS ALWAYS COME BACK
00:59
dednahype
Рет қаралды 147 МЛН
I CAN’T BELIEVE I LOST 😱
00:46
Topper Guild
Рет қаралды 116 МЛН
Swipe gestures in Recycler View | Android
18:47
Mafia Codes
Рет қаралды 61 М.
Best Open Source Apps NOT on the Play Store!
9:25
HowToMen
Рет қаралды 405 М.
React drag and drop sort list
23:34
Bikash web
Рет қаралды 49 М.
Android Studio - Drag and Drop Items RecyclerView (2018)
4:03
Programming Hustle
Рет қаралды 14 М.
How ChatGPT Built My App in Minutes 🤯
8:28
Website Learners
Рет қаралды 2,1 МЛН
Highlight, Move, and Swipe RecyclerView with ItemTouchHelper
21:03
CodingWithMitch
Рет қаралды 26 М.
Top 10 CSS One Liners That Will Blow Your Mind
13:34
developedbyed
Рет қаралды 921 М.
KINDNESS ALWAYS COME BACK
00:59
dednahype
Рет қаралды 147 МЛН