RecyclerView - Android Studio Tutorial | Part 1
ฝัง
- เผยแพร่เมื่อ 1 ต.ค. 2024
- 🏆 My Online Courses
⭐Discount Coupon: LAUNCH-STEVDZA-SAN
stevdza-san.com
🐱👤 Wanna become a member? Join!
/ @stevdzasan
📸 Instagram
/ stevdza_san
RecyclerView tutorial will be separated in 2 parts. In the fist part we are going to implement RecyclerView in MainActivity, then we are going to create Adapter, custom rows for it, and populate our RecyclerView with the data. And in the second part we are going to implement onClickListener for our RecyclerView items so whenever we select any of those items we are going to open a new Activity and pass the data from RecyclerView. Enjoy! :)
ABOUT
The RecyclerView is a ViewGroup that renders any adapter-based view in a similar way. It is supposed to be the successor of ListView and GridView. One of the reasons is that RecyclerView has a more extensible framework, especially since it provides the ability to implement both horizontal and vertical layouts. Use the RecyclerView widget when you have data collections whose elements change at runtime based on user action or network events.
After struggling with the official documentation for days, I can say that this guy is way more helpful than the official documentation by Google.
My error:
Attempt to invoke virtual method 'void android.widget.TextView.setText(java.lang.CharSequence)' on a null object reference
getting error :
Attempt to invoke virtual method 'java.lang.Object android.content.Context.getSystemService(java.lang.String)' on a null object reference
at android.view.LayoutInflater.from(LayoutInflater.java:235)
at com.dhanraj.recycleview.Myadapter.onCreateViewHolder(Myadapter.java:31)
at com.dhanraj.recycleview.Myadapter.onCreateViewHolder(Myadapter.java:14)
thank you very helpfull for beginners.
I hit subscribe because you go straight to the point in only 16min without any problem or bug . it worked perfectly ;) thanks Stev !
Instead of renaming the parameters, since the attributes are directly inside the class, you can use "this" to reference that instance of the class.
At 7:31, you can use this.images = images; also use private scope for the attributes.
True. It's still bad practice to have the same name though.
@@dannybee6473 Really? I prefer using same names throughout the project for the same data reference. Just my opinion.
@@edgarwideman737 it's against most industry readability/style standards.
@@dannybee6473 so the "this.fuu" is bad practice?
@@edgarwideman737 No. It's bad to use the same variable names for public variables and class variables. Typically you'll throw on a m for class variables. So this.mImages = images.
This was an "ahaah" moment, thank you!
Many thanks! This helped me so much!
All you need to know, short, to the point. Perfection!
Hello 2022 Bootcamp! :D
im having a problem with java.lang.ArrayIndexOutOfBoundsException: length=1; index=1 using images.length can u give me some solution for this? thanks
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myrecycleview/com.example.myrecycleview.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View androidx.recyclerview.widget.RecyclerView.findViewById(int)' on a null object reference..
this is the error I'm getting can anyone help meee pleaseee.
same here
@@sahhar.grooves there is a comment below which solves this problem.
Hi, why does mine says, "Unfortunately it as stopped" when i tried to launch it
why don't you upload your tutorials on github? It is very annoying to sit through all these every time I just want to check something quick
idk your stuff works, but your explanation is bad.
This guy is better than every damn teacher in my college
You shared very nice video with TH-cam. Thanks
I have a problem with this code. The items in my recycle view keeps duplicating. Can anyone help? :((
When I use MeowBottomNavigation, it closes the Edittext keyboard?
Sir, can you tell me why this problem?
why are you use this line ?
recycleview.setLayoutManager(new LinearLayoutManager(this));
I am a bit lost here, Android Studio tells me, that this method doesn't exist.
Hey thanks for this amazing tutorial👨🏫📓
I want a nested recycler view tutorial can you 🙏 provide for me
Really Good video. Helped me a lot . Thank you so much!
recyclerView.setadapter(myadapter); هذا الكود يطلع عندي غلط ليش
Maybe he was trolling us?
No one do RecyclerView with MVP pattern, but well your tutorial is very nice.
which is best method to do Recycler view
Visual Studio is not a programming language. BTW, tutorial is fabulous
no issue try learn the concept of recycler view
@@adobexd4514 if u so good in progamming then why u came here lol go and read more about visual studio
Hi ! Tks for the video. Could you please answer a little question that I did in Part 2 ?
can i know this project using kotlin or java?
can i customized recyclerview? such as giving 350dp instead match parent
Great video! Is there a reason you are mixing Java and Kotlin? For instance, why would you not Just use K?
This is good but I can't get more than 10 values
Can u suggest what's the problem
can you add the source code? I've tried coding this from your video and I cannot get it to work :/
Programming languages: Visual Studio
*face palm*
The tutorial was good, though
visual studio is a programming language?
In the 14:26 step I am getting error please help he
Programming language list
*"Proceeds to enter visual studio"*
you are very greate teacher! thank you!!!!
Do the new androidx libs still expose all of the same methods / components as the android.support counterparts? If I am using recycler view, do i still implement it the same way and just add the new dependency instead of the old, or do I need to change the configuration/ implementation somehow?
I got lost after "attachToRoot:false" could not be resolved 12:45
Tačno se po glasu čuje da si naš. 😂
Lol, I probably rewrote my recycler view adapter code a couple times before realizing I was still returning 0 for the item count
And the relief afterwards 😌
Is it the same process when you add items by a button click?
i did as same as you did but it didn't work. can you give me info.
Nice tutorial thank you. Just one thing I would like to know. How did the dependencies automatically add? For me I have to manually add them to app.gradle file
Can I get the code?
Hello, thankyou for the tutorial. it really helped me. Could you please make video about search filter on recycle view? Thank you so much.
I already have: th-cam.com/video/rn53Roy-HgE/w-d-xo.html
kotlin Language?
Nice and easy to understand, thank you!
11:44 That what I was looking for, thanks mate!
Is it possible to use the same array items in Kotlin?
I've been watching video about this subject for a while, and first of all you're the first one that starts out immediately and doesn't fuck around with "guys don't forget to like and subscribe" and secondly you're explaining this in normal english and not trying to speak like a professor , got my like and sub!
why is my app keep not responding if i scrolldown to the last item?
nvm, my string and image is not the same size
@@panduananto1033 that was super helpful Pandu. I was having the same problem
Thankssssssssssssssssss a lot sir
Thankyou ..! It helped so mutch👍❤
Please , what event to add to retrieve when I slide my finger over an item
i neeeeeeed the souce code!
Nice tutorial Stevdza, quite clear, all the way through. But I am a newbee at this and... I got all the way to the end and got a compile error in the MyView Holder class:
IdeaProjects\MySqlConnection\app\src\main\java\com\georgehunt\mysqlconnection\MyAdapter.java:47: error: constructor ViewHolder in class ViewHolder cannot be applied to given types;
public MyViewHolder(@NonNull View itemView) {
^
required: View
found: no arguments
reason: actual and formal argument lists differ in length
This my entire class definition:
public class MyViewHolder extends RecyclerView.ViewHolder {
TextView textViewDay;
TextView textViewDateTime;
public MyViewHolder(@NonNull View itemView) {
super(itemView);
textViewDay = itemView.findViewById(R.id.textViewDay);
textViewDateTime = itemView.findViewById(R.id.textViewDateTime);
}
}
I can't for the life of me see what it's complaining about. Any thoughts?
Thanks
You're awesome dude. This tutorial very nice. You should come to my collage and replace my lecturer
can someone explain how to select images from the net as these images lead to uneven arrangements due to different sizes
very usefull thank you so much
Can we send and retrieve data from multiple activities to one recycler view? Please rply
You can persist the data with Data Store or ROOM if there's no other way.
@@StevdzaSan i didn't get you sir
I send and retrieve 1st data from one activity then i try to send 2nd data from another activity to firebase now i want to access the 1st and 2nd data to one recycler view. Please kindly help me
Thanks I had difficulties in understanding recycler view adapter,its clear now for me!
helo sir,how can i use recyclerview in fragments in drawer navigation activity.kindly help me.
thanks for tutorial! it really helps me in my university course work
can i also add cheboxes next to that?
THANK YOU SO MUCHHHHH
Sir it shows that app keeps stopping
my one same problem bro
We have to resize the images for proper functioning oh recycler view.....
Thank you very much! This was super helpful. Cheers :)
Thank you very much for this! Amazing
Very nicely explain, Thank you
always a lifesaver
Tthanks
Thanks, Man you explained very well
it's really easy to understand, thanks!!
Nice dude
how to use diffutil in recyclerview?
Awesome thank you.
Thank you for the video. Can I access the full project somehow please?
Thank you so much, you are great!
Thank you very much.
Hvala ti brate! Puno si pomogao :)
Nice teaching style
Thank you so much!
Nice teaching style
where did you get R.array from, its complaining about array
Rebuild your project, or close Android Studio and run it again.
thank you so much, all my recyclerviews crashed, your tutorial helped me
Thank you :) great job ;)
Very helpful !!
Thank you :)
for me it only shows one card view???? I have changed my_row.xml: android:layout_height="wrap_content". Can someone help me
try to slide your screen all the way down, they are down there, happen to me to...
@@fabianramirez338 I had the same issue. Thanks!
Nice mascot.
Thank you very much! That was very clear and easy to understand
the distance between the items is showing far why ??
Check your row layout file. Root layout should have a height attribute of wrap_content instead of match_parent.
thank you so much :) your video help me a lot
I FAKING LOVE YA MATE
Thank u very much
really clear. Thanks.
How to make recyclerview item with a Spinner?
Great video
great tutorial thnx for it.