RecyclerView
ฝัง
- เผยแพร่เมื่อ 29 ส.ค. 2024
- Learning android development for complete beginners (FREE COURSE): codingwithmitc...
In this video I show you how to use a RecyclerView to display list items with an image and text.
You'll learn to build a recyclerview adapter class from scratch and display images and text. To retrieve the images from the internet we use the "Glide" library.
This is a perfect example if you're a beginner and need a step-by-step example on how to use a recyclerview in your android project.
➤Source Code:
↻ github.com/mit...
➤Check out our website:
↻ CodingWithMitch.com
I spent hours trying to follow the official guides and messing stuff up until I found this. This was very very comprehensive. Thank you very much!!!
Same
same
The official documentation is pure sorcery! Written by an ancient civilization with a long lost language, requires you to be better than a native speaker and to know everything that was written at that point in time to fully understand and comprehend the teachings that there lies.
Same, are we stupid ?
Following a 200$ course and came here to learn
Finally a video without bullshit. Please do more. Your videos are perfect. Thanks Mitch!
This is a no bullshit zone
I've looked through a good number of tutorials on recyclerviews trying to understand them and this is the first one that actually makes sense to me.
For macOS, the shortcut to generate constructor is command + n. Thank you so much for the video!! It was a great help.
Great video man, You are one of the reasons why I started my own channel for coding tutorials too! Just wanted to say keep up the great work
I was struggling for days about how to make a working RecyclerView and this is what cracked it for me. Thank you!
I usually don't comment videos but you explain really well, you're easy to follow and i think i learned a lot of stuff applicable elsewhere, not just with recyclerviews so thank you, you got my thumbs up!
Thanks for taking the time to leave a comment.
You should watch this course. It's free and great for beginners. Tons of fundamental skills. codingwithmitch.com/courses/sqlite-room-persistence-android/
FABULOUS Lesson!! Your explanations filled in the gaps that other courses don't mention. Thanks!!
I have already tried this by watching other videos without understanding anything . Thanks dude you made me understand what RecycleraView actually is.
Saved my day man! I've spent two days looking for a way of displaying the data I was receiving as a result from my database, and your method just did it! Thanks!
Beautifully explained video. Every part covered and fully explained as you go along. I'm an iOS developer by trade with little Java or Android development and by explaining the purpose of each function I was able to relate back to my iOS knowledge. If I could subscribe twice, I would.
Better than any documentation i found out there, and man, i really tried to follow the official guides, your video really helped me, thx
I just read a couple articles on how to add a RecyclerView, and it's much more complicated to follow along with that. Thanks for this video. You made it very simple and easy to understand!
Yeah video is much easier when your starting out.I have a course designed specifically for beginners if you're interested. It's free: codingwithmitch.com/courses/sqlite-room-persistence-android/
@@codingwithmitch thank you I'll def check it out
Mitch! You the man. This was clear and not bloated with unnecessary steps and jargon. Thanks a lot!
I just discovered your channel, and I am really looking forward to rely on your tutorials to proceed ahead. You've covered so many important features that I'll be needing.
Thanks a ton!
Check the courses on my website too. I got stuff for all levels. And lots of it is free. codingwithmitch.com/
it's awesome when you say the red underline as - its angry! ----- it makes the error funny and less scary :D
I never comment on stuff, but boy are you a life saver! Thank you so much, you made my day!
Sir You are one of the most helpful and generous TH-camrs who teaches amazing stuff
For those of you working with fragments. You have to inflate the view of the fragment and can't just pass
the context. So you can do the following:
View view = inflater.inflate(R.layout.YOUR_FRAGMENT_NAME_HERE, container, false);
Then you have to pass the context of that view in the adapter. The same method will apply for when setting the layout manager.
YourAdapter AdapterName = new YourAdapter(YourArrayListObject, view.getContext());
Hope this will help some of you.
You sir are an absolute legend. Thank you for saving me probably hours of troubleshooting and pointing me in the right direction to apply this with fragments :) There were a couple of other stack overflow threads that helped too: stackoverflow.com/questions/26621060/display-a-recyclerview-in-fragment and stackoverflow.com/questions/30598871/can-not-resolve-method-findviewbyidint
can u write exactly the coding, im so confusing and i have problem
@@ProGunn3rz This was what my HomeFragment.java looked like (excluding the initBitmaps() method and note the fragment layout is called layout_home, seems to work for me :
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
import android.util.Log;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.LinearLayoutManager;
public class HomeFragement extends Fragment {
private static final String TAG = "HomeFragement";
//cars
private ArrayList mNames = new ArrayList();
private ArrayList mImageUrls = new ArrayList();
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
initImageBitmaps();
View view = inflater.inflate(R.layout.fragment_home, container, false);
Log.d(TAG, "initRecyclerView: init recyclerview.");
RecyclerView recyclerView = view.findViewById(R.id.recyclerv_view);
RecyclerViewAdapter adapter = new RecyclerViewAdapter(mNames, mImageUrls, view.getContext());
recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(new LinearLayoutManager(view.getContext()));
Log.d(TAG, "initRecyclerView: finsihed recyclerview.");
return view;
}
I don't think there was anything else I had to do either
Should the code in the video be working if I am not using fragments? For some reason, even copying the tutorial line by line it still doesn't work. Has the recyclerView been update or some changes been made to it?
Edit: Apparently it's all fine until it gets down to trying to find the parent context, so after I go View view = ... it just can't find the parent by any means.
Thanks a lot man. Very easy to follow. I have followed two tutorials before this one. This is the first one that worked
You kill me with your "It's angry" xDD
thanks man it's very useful i watch all of your android learning videos plz continue best android learning youtube chanell
This was very well done! I appreciate that you included the "why" along with the "how." I look forward to viewing more of your tutorials!
I got plenty 😬
I am a beginner in Android. This video is really helpful
Mitch the savior. Nothing can be better and easier than the way you explain. Thanks a ton. Keep up the good work bro!
This tutorial is just so much better than any other I could find about RecyclerView. Thank you dude!
Awesome! Like the previous commentator, I found this comprehensive and effective.
One little hiccup I experienced is that my new version of Android Studio defaults to androidx, which I chose to use. In initRecyclerView() I had to use:
androidx.recyclerview.widget.RecyclerView recyclerView = findViewById(R.id.recycler_view);
rather than:
RecyclerView recyclerView = findViewById(R.id.recycler_view);
This is just brilliant! Super comprehensive, not to mention, easy to follow. Thanks a lot for this!
Watch this free course next codingwithmitch.com/courses/sqlite-room-persistence-android/
for those on Ubuntu, the shortcut used at 12:16 to create a class constructor is Alt + Insert
This shortcut worked for me in Windows 10
Really like the fact that you are building it from the ground up. That's what I was searching for. Big thumbs up for that!!
You're the best when it comes to explaining difficult stuff
I am not a programmer. I used a little bit of Visual Basic before. This is far more complicated. I started to learn both Java and Android development from scratch. Even though it is very complicated I compiled Google Maps and Google Directions API application with ease just following your course since your courses are one of the best available. Your explanation is awesome. Please continue to provide us all these excellent contents in your courses.
Since I was learning Java at the same time, I read quite a bunch of documentation pages about basic Java concepts including generics which I’ve never used in visual basic. Therefore, I am meticulous to comprehend fully what I am trying to accomplish through this code while you explain in your course.
I was trying to figure out what the overridden methods really do. I made a few guesses. This actual adapter super class works like a loop (like a for loop) since the local ViewHolder class that we created works as an iterator just to hold the values of the one recycler_item temporarily for each item during the process. onCreateViewHolder() method takes the ViewGroup (parent_layout) with the individual View objects in it as a template and duplicates them as new objects one under the other with the constructor “ViewHolder holder = new ViewHolder(view)” during the iteration. At the same time onBindViewHolder method takes the new duplicated ViewHolder and fills the inner views (image, imagetext) regarding the declared rules in the method. This loop continues until it reaches the value evaluated from the getItemCount() method. I struggled on all these assumptions because I was trying to find out the function of the variable “position” which is used in the form of “get(position)” but we did nothing to calculate it, so I thought the super RecyclerViewAdapter class handles all this operation for us like a for loop and the position is the current item being operated in the loop. So the super class does everything. I am not sure if I am wrong with all these assumptions and we don’t need a thorough explanation of it since this information is not necessary to make it work. It’s just the struggle of me trying to learn how it actually works.
Straight to the point with some bonus tricks.
Brilliant!
Thanks
If make part 2 when click on the items recycle view go to next page to show details text other text
Samir Dev you can use explicit intents. Using OnClickMethod you can use it.
He has made another video on your request. Thanks Samir i also had same request.
@@rupeshsinghindiawould you care to share the link?
That alt+shift+insert is really useful, thanks for the tip!
Best tutorial on a complicated topic. Really well done !
Great guide! You have a casual way of explaining things that makes technical challenges understandable and solvable. Naturally, with technology-based content, it can quickly become outdated. For example "compile" is now deprecated, along with some other elements. Regardless, I subscribed!
Very clearly spoken & demonstrated, Thank you.
Although i know about recycler view but its still fun and informative to watch your video !!! thinking of binge watching your entire channel !!!
One of the best explanation for recycler view, thanks
Check out the kotlin one th-cam.com/video/Jo6Mtq7zkkg/w-d-xo.html
i spend 2 days on this . but these guides me very well ... thank you
Nice tutorial. Gets one up to speed with the RecyclerView very fast. Thank you.
You sir, is the true hero!
Thank you very much. You are such a life saviour lol. I finished my assignment in 30 minutes. Really appreciate it your the best =)))
For those using window , Alt+Insert or Right Click > Generate to create constructor if the shortcut doesnt work .
I can always count on you to make tutorials that I can easily understand. Thanks!
I didn't know that 'logt' thing. Thanks man. That's very helpful :)
amazing tutorial on recyclerview Mitch.... nice content.... a big thanks..from Etobicoke (town) ,On,Canada
Thanks a lot, man. Very precise and straightforward tutorial. You, sir, are a scholar and a gentleman. A sub from me and looking forward to more.
If you're a beginner your should watch this course. It's free. You'll learn a ton of fundamental skills.
codingwithmitch.com/courses/sqlite-room-persistence-android/
best tutorial channel on TH-cam. thanks a lot!
awesome. love the way OnclickListener is handled here. I was searching for the same and found stackoverflow answers are so much more complicated...
thank you very much , I have never understood the RecyclerView like this before.
You are one of the best. ❤️❤️❤️
You not only writes codes...
You actually teaches the code. You explain why are you writing that line. That awesome i have found in any of the TH-cam video.
Keep going. You have gained your one fan follower ❤️❤️❤️🇮🇳
I would like to follow you in facebook , please provide me your id.
Hello mitch
Your videos are awesome
But I have some questions
1. Why do you add dependencies by searching online, you can always add library dependencies from the project structure in android studio
2. In order to create activities and fragments you create separate files manually, you can always add activities and fragments by right clicking on packages of the project and Android studio will generate the activity and fragment files for you.
Thanks. Keep up the great work
why he search dependencies by online because he want to show us the dependencies original website , so for newbie , they can understand more about the dependencies .
Maybe he's just being nice paying respect to the original developer
i m following long back to you Android vedio now in india flutter is demand and i love the u way teach in Android this is humble request to you thanks Mitch
Dear sir I am extremely pleased and thank you for all of your series of videos for Recycler View which give us a lot of information sir I would like request you to make a video for generating a multiple paged pdf containing all records in the table not for only one particular record. I will remain thankful forever to you if you make this video for android learners.
Thank you, sir, for the material you delivered ....
Thanks so much. I found it more helpful than my coaching. Thanks
THANK YOU SO MUCH YOU EXPLAINED IT IN SUCH AN AMAZING QUICK AND SIMPLE WAY!!!!
Tnx Mitch ! that's was one of the best tutorials I seen so far ! well done friend :)
Sir you are really great .Please sir make video on Android Geofencing .Your videos are really helpfull for me .
Thanx
Thanks for this tutorial mitch, it was really insightful and helpful.
In other to improve on this tutorial, I suggest that you try to explain what some of the individual methods and keywords means to enable us have better understanding just as you do.
Thanks once again
first non indian guy! great to find you mate!
Thanks for the video! Helped me a lot with setting up my recycler view for the first time.
Thank you ..Mitch👍
Thank you very much for this tutorial. It helps us a lot to understand how to use recycle view.
Clear and To the point tutorial, appreciate it so much
Dense, clear descriptions - you da man, Mitch!
Thank you so much. I "really" learned the recycler view now.
This guy is amazing! Honestly, he's shown me the way many times haha
awesome video man, clear and concise... subscribed instantly. Keep them coming
Thanks a lot man! this is exactly what I was looking for, so clear and perfect explanation, continue as well as you do know. I get subscribed. Greetings from Mexico!
Wonderful tutorial. Very simple and smart. Thank you very much! You helped me a lot
!
Smooth and understandable.Great work
Hi Mitch, This was very easy to follow. Thank you.
Thank you for honor your video ! i am request to RecyclerView funtion is add, edit(modify), delete. Good luck Mitch!!
Thanks a lot Mitch..Great Tutorial and step by step explanation was really good...
you make everything simple. good job
For my keyboard alt insert worked.
Btw this was the only tutorial that I could get a working app with. thanks
Congratulations! Keep up the good work! Your video helped me a lot.
Thanks. Very useful and easy to understand.
Most detailed tutorial.....Great explaination! Thanks :)
Thank You So Much sir! Your tutorials always great
This guy is super cool, thanks alot for the video!
You should do an updated version of this video which deals with the recycler view in and environment using SDK version 28 or higher. Seems like it would be a challenge for newer developers to try migrating to androidx libraries on their own. Just a thought.
Thank you very much for explaining everything very clearly.
Exactly what I needed! Thank you very much! :D
very good work
it is very well explained and very well presented
Getting this error, and can't find where I did a mistake: Attempt to invoke virtual method 'void androidx.recyclerview.widget.RecyclerView.setAdapter(androidx.recyclerview.widget.RecyclerView$Adapter)' on a null object reference
Hey this video is really awesome....thanks mitch 😍😎
great, good job mitch.
thank u so much mitch love from india
awesome explanation thanks a bunch made it easy to follow
No problem brother. If you want a great beginners course I got a free one you can watch: codingwithmitch.com/courses/sqlite-room-persistence-android/
Can you also make part 2 of this tutorial where you can go to next activity when you click this recycler view, and also, can you add search view too, thanks :D
There is a part 2: th-cam.com/video/ZXoGG2XTjzU/w-d-xo.html.
As for the SearchView, I have a course on Pluralsight and one of the modules I show you how to set up a SearchView: app.pluralsight.com/library/courses/android-keyboard-inputs-getting-started/table-of-contents
Watch it free with this: pluralsight.pxf.io/c/1194789/424552/7490
CodingWithMitch thank you very much
Very helpful. Thanks
👍before watching it, because I know I rd s going to be amazing video like always. Thank you Mitch!
Great tutorial. Easy to understand even for beginners. But why did you use parent.getContext() inside onCreateViewHolder() method when you had saved a local copy of the Context anyways in mContext? We can replace parent.getContext() with mContext, right?
Ya you could have just used mContext instead of parent.getcontext ()
Kinda late, but this was very helpful. I was struggling with the RecyclerView, but this helped!
Sir plz make a detailed video on Android Geofencing plz sir it's a request
I love your videos..
Thanku sir..for your g8 efforts..
This isn't a big issue or anything but I noticed that the onclick animation only goes off on the first index. But for other index it doesn't have the splash animation.