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.

ความคิดเห็น • 162

  • @hannes6390
    @hannes6390 3 ปีที่แล้ว +30

    After struggling with the official documentation for days, I can say that this guy is way more helpful than the official documentation by Google.

  • @hemalraval8903
    @hemalraval8903 2 ปีที่แล้ว +1

    My error:
    Attempt to invoke virtual method 'void android.widget.TextView.setText(java.lang.CharSequence)' on a null object reference

  • @dhanrajdesai3668
    @dhanrajdesai3668 4 ปีที่แล้ว +1

    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)

  • @dostonmaxsumov2371
    @dostonmaxsumov2371 2 ปีที่แล้ว +1

    thank you very helpfull for beginners.

  • @paristourguide8019
    @paristourguide8019 4 ปีที่แล้ว +6

    I hit subscribe because you go straight to the point in only 16min without any problem or bug . it worked perfectly ;) thanks Stev !

  • @Sectimus
    @Sectimus 4 ปีที่แล้ว +24

    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.

    • @dannybee6473
      @dannybee6473 3 ปีที่แล้ว +1

      True. It's still bad practice to have the same name though.

    • @edgarwideman737
      @edgarwideman737 ปีที่แล้ว

      @@dannybee6473 Really? I prefer using same names throughout the project for the same data reference. Just my opinion.

    • @dannybee6473
      @dannybee6473 ปีที่แล้ว

      @@edgarwideman737 it's against most industry readability/style standards.

    • @edgarwideman737
      @edgarwideman737 ปีที่แล้ว

      @@dannybee6473 so the "this.fuu" is bad practice?

    • @dannybee6473
      @dannybee6473 ปีที่แล้ว

      @@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.

  • @Another0neTime
    @Another0neTime 3 ปีที่แล้ว +6

    This was an "ahaah" moment, thank you!

  • @shimanotaka
    @shimanotaka 4 ปีที่แล้ว +9

    Many thanks! This helped me so much!

  • @paramvirsingh5640
    @paramvirsingh5640 3 ปีที่แล้ว +4

    All you need to know, short, to the point. Perfection!

  • @jhhtaylor
    @jhhtaylor 2 ปีที่แล้ว +1

    Hello 2022 Bootcamp! :D

  • @devaandrafadila843
    @devaandrafadila843 2 ปีที่แล้ว

    im having a problem with java.lang.ArrayIndexOutOfBoundsException: length=1; index=1 using images.length can u give me some solution for this? thanks

  • @adityasadaphule2187
    @adityasadaphule2187 3 ปีที่แล้ว +1

    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.

    • @sahhar.grooves
      @sahhar.grooves 3 ปีที่แล้ว

      same here

    • @adityasadaphule2187
      @adityasadaphule2187 3 ปีที่แล้ว

      @@sahhar.grooves there is a comment below which solves this problem.

  • @darkclouds98
    @darkclouds98 ปีที่แล้ว

    Hi, why does mine says, "Unfortunately it as stopped" when i tried to launch it

  • @muhammadsarimmehdi
    @muhammadsarimmehdi 2 ปีที่แล้ว

    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

  • @MyDutchproductions
    @MyDutchproductions 3 ปีที่แล้ว

    idk your stuff works, but your explanation is bad.

  • @sugar-lx1jz
    @sugar-lx1jz 2 ปีที่แล้ว +1

    This guy is better than every damn teacher in my college

  • @Anoopmoji
    @Anoopmoji 4 ปีที่แล้ว +1

    You shared very nice video with TH-cam. Thanks

  • @NashEqui17brium
    @NashEqui17brium 2 ปีที่แล้ว

    I have a problem with this code. The items in my recycle view keeps duplicating. Can anyone help? :((

  • @shabdata7186
    @shabdata7186 3 ปีที่แล้ว

    When I use MeowBottomNavigation, it closes the Edittext keyboard?
    Sir, can you tell me why this problem?

  • @muralicse3637
    @muralicse3637 4 ปีที่แล้ว

    why are you use this line ?
    recycleview.setLayoutManager(new LinearLayoutManager(this));

    • @JonathanHoffmann369
      @JonathanHoffmann369 3 ปีที่แล้ว

      I am a bit lost here, Android Studio tells me, that this method doesn't exist.

  • @TechnicalBolt
    @TechnicalBolt 3 ปีที่แล้ว

    Hey thanks for this amazing tutorial👨‍🏫📓
    I want a nested recycler view tutorial can you 🙏 provide for me

  • @laibaa_younas
    @laibaa_younas 4 ปีที่แล้ว +2

    Really Good video. Helped me a lot . Thank you so much!

  • @صنعانيكشخه2024
    @صنعانيكشخه2024 3 ปีที่แล้ว

    recyclerView.setadapter(myadapter); هذا الكود يطلع عندي غلط ليش

  • @wilcas5349
    @wilcas5349 4 ปีที่แล้ว +1

    Maybe he was trolling us?

  • @notengosusto
    @notengosusto 4 ปีที่แล้ว +3

    No one do RecyclerView with MVP pattern, but well your tutorial is very nice.

    • @saranpandiyan619
      @saranpandiyan619 4 ปีที่แล้ว

      which is best method to do Recycler view

  • @paristar3079
    @paristar3079 4 ปีที่แล้ว +2

    Visual Studio is not a programming language. BTW, tutorial is fabulous

    • @adobexd4514
      @adobexd4514 4 ปีที่แล้ว

      no issue try learn the concept of recycler view

    • @viralworld686
      @viralworld686 4 ปีที่แล้ว

      @@adobexd4514 if u so good in progamming then why u came here lol go and read more about visual studio

  • @robertocampos8463
    @robertocampos8463 2 ปีที่แล้ว

    Hi ! Tks for the video. Could you please answer a little question that I did in Part 2 ?

  • @ainulwafiq8667
    @ainulwafiq8667 2 ปีที่แล้ว

    can i know this project using kotlin or java?

  • @tnnz9920
    @tnnz9920 3 ปีที่แล้ว

    can i customized recyclerview? such as giving 350dp instead match parent

  • @laurentbajrami3688
    @laurentbajrami3688 3 ปีที่แล้ว +1

    Great video! Is there a reason you are mixing Java and Kotlin? For instance, why would you not Just use K?

  • @dhakshnamoorthy8673
    @dhakshnamoorthy8673 3 ปีที่แล้ว

    This is good but I can't get more than 10 values
    Can u suggest what's the problem

  • @mickmaszt4485
    @mickmaszt4485 2 ปีที่แล้ว

    can you add the source code? I've tried coding this from your video and I cannot get it to work :/

  • @FeLiNe418
    @FeLiNe418 4 ปีที่แล้ว +6

    Programming languages: Visual Studio
    *face palm*

    • @kolo6518
      @kolo6518 4 ปีที่แล้ว +1

      The tutorial was good, though

  • @ahmadpirzargar6883
    @ahmadpirzargar6883 2 ปีที่แล้ว

    visual studio is a programming language?

  • @quickcricket9375
    @quickcricket9375 3 ปีที่แล้ว

    In the 14:26 step I am getting error please help he

  • @adamgonzales8677
    @adamgonzales8677 3 ปีที่แล้ว

    Programming language list
    *"Proceeds to enter visual studio"*

  • @mahdipaydar2954
    @mahdipaydar2954 ปีที่แล้ว

    you are very greate teacher! thank you!!!!

  • @natetolbert3671
    @natetolbert3671 4 ปีที่แล้ว

    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?

  • @Dabayare
    @Dabayare 3 ปีที่แล้ว

    I got lost after "attachToRoot:false" could not be resolved 12:45

  • @milosmaric8733
    @milosmaric8733 3 ปีที่แล้ว

    Tačno se po glasu čuje da si naš. 😂

  • @mahmoudnadi9683
    @mahmoudnadi9683 2 ปีที่แล้ว

    Lol, I probably rewrote my recycler view adapter code a couple times before realizing I was still returning 0 for the item count

    • @StevdzaSan
      @StevdzaSan  2 ปีที่แล้ว

      And the relief afterwards 😌

  • @VaLe-rk2dj
    @VaLe-rk2dj 3 ปีที่แล้ว

    Is it the same process when you add items by a button click?

  • @ahmadfawadkhairzad6957
    @ahmadfawadkhairzad6957 3 ปีที่แล้ว

    i did as same as you did but it didn't work. can you give me info.

  • @priyanthafernando2849
    @priyanthafernando2849 2 ปีที่แล้ว

    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

  • @BrianSteve
    @BrianSteve ปีที่แล้ว

    Can I get the code?

  • @curzedblezzed
    @curzedblezzed 2 ปีที่แล้ว

    Hello, thankyou for the tutorial. it really helped me. Could you please make video about search filter on recycle view? Thank you so much.

    • @StevdzaSan
      @StevdzaSan  2 ปีที่แล้ว

      I already have: th-cam.com/video/rn53Roy-HgE/w-d-xo.html

  • @kgsal-fatih264
    @kgsal-fatih264 4 ปีที่แล้ว +1

    kotlin Language?

  • @yrrag
    @yrrag 3 ปีที่แล้ว +1

    Nice and easy to understand, thank you!

  • @shinuza
    @shinuza 2 ปีที่แล้ว

    11:44 That what I was looking for, thanks mate!

  • @alexnduta2054
    @alexnduta2054 2 ปีที่แล้ว

    Is it possible to use the same array items in Kotlin?

  • @noamif
    @noamif 3 ปีที่แล้ว

    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!

  • @panduananto1033
    @panduananto1033 4 ปีที่แล้ว +1

    why is my app keep not responding if i scrolldown to the last item?

    • @panduananto1033
      @panduananto1033 4 ปีที่แล้ว +1

      nvm, my string and image is not the same size

    • @ftdesigner91
      @ftdesigner91 4 ปีที่แล้ว

      @@panduananto1033 that was super helpful Pandu. I was having the same problem

  • @sanarahman6996
    @sanarahman6996 2 ปีที่แล้ว

    Thankssssssssssssssssss a lot sir

  • @dushanmadushanka3272
    @dushanmadushanka3272 3 ปีที่แล้ว

    Thankyou ..! It helped so mutch👍❤

  • @DellohBorisOuahou
    @DellohBorisOuahou 3 ปีที่แล้ว

    Please , what event to add to retrieve when I slide my finger over an item

  • @allardgodfrey
    @allardgodfrey 3 ปีที่แล้ว

    i neeeeeeed the souce code!

  • @ghunt2121
    @ghunt2121 4 ปีที่แล้ว

    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

  • @xeronite349
    @xeronite349 3 ปีที่แล้ว

    You're awesome dude. This tutorial very nice. You should come to my collage and replace my lecturer

  • @prasannpatil3371
    @prasannpatil3371 4 ปีที่แล้ว

    can someone explain how to select images from the net as these images lead to uneven arrangements due to different sizes

  • @parth2076
    @parth2076 2 ปีที่แล้ว

    very usefull thank you so much

  • @shughlavirtualstore8862
    @shughlavirtualstore8862 3 ปีที่แล้ว

    Can we send and retrieve data from multiple activities to one recycler view? Please rply

    • @StevdzaSan
      @StevdzaSan  3 ปีที่แล้ว

      You can persist the data with Data Store or ROOM if there's no other way.

    • @shughlavirtualstore8862
      @shughlavirtualstore8862 3 ปีที่แล้ว

      @@StevdzaSan i didn't get you sir

    • @shughlavirtualstore8862
      @shughlavirtualstore8862 3 ปีที่แล้ว

      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

  • @azeezmoiz9195
    @azeezmoiz9195 3 ปีที่แล้ว

    Thanks I had difficulties in understanding recycler view adapter,its clear now for me!

  • @sidrahameed8564
    @sidrahameed8564 4 ปีที่แล้ว

    helo sir,how can i use recyclerview in fragments in drawer navigation activity.kindly help me.

  • @dmitrykudelich4882
    @dmitrykudelich4882 3 ปีที่แล้ว

    thanks for tutorial! it really helps me in my university course work

  • @aleksandretvaradze7178
    @aleksandretvaradze7178 3 ปีที่แล้ว

    can i also add cheboxes next to that?

  • @tinaranathania
    @tinaranathania 4 ปีที่แล้ว +2

    THANK YOU SO MUCHHHHH

  • @happymind947
    @happymind947 4 ปีที่แล้ว +1

    Sir it shows that app keeps stopping

  • @kartikeyepandey953
    @kartikeyepandey953 4 ปีที่แล้ว

    We have to resize the images for proper functioning oh recycler view.....

  • @iL0neW0lf
    @iL0neW0lf 3 ปีที่แล้ว

    Thank you very much! This was super helpful. Cheers :)

  • @ibrahimawone8137
    @ibrahimawone8137 3 ปีที่แล้ว

    Thank you very much for this! Amazing

  • @technomj6176
    @technomj6176 4 ปีที่แล้ว +1

    Very nicely explain, Thank you

  • @mannukim
    @mannukim 3 ปีที่แล้ว

    always a lifesaver
    Tthanks

  • @cartist3019
    @cartist3019 3 ปีที่แล้ว

    Thanks, Man you explained very well

  • @firdausbaihaqi6961
    @firdausbaihaqi6961 4 ปีที่แล้ว +1

    it's really easy to understand, thanks!!

  • @pratibhapatil3265
    @pratibhapatil3265 2 ปีที่แล้ว

    Nice dude

  • @pushkaragnihotri1609
    @pushkaragnihotri1609 4 ปีที่แล้ว

    how to use diffutil in recyclerview?

  • @mayoonmayoon1685
    @mayoonmayoon1685 3 ปีที่แล้ว

    Awesome thank you.

  • @athenodor
    @athenodor 4 ปีที่แล้ว

    Thank you for the video. Can I access the full project somehow please?

  • @hasan_eke
    @hasan_eke 3 ปีที่แล้ว

    Thank you so much, you are great!

  • @Динислам-ы8й
    @Динислам-ы8й 3 ปีที่แล้ว

    Thank you very much.

  • @tenchi_ii
    @tenchi_ii 3 ปีที่แล้ว

    Hvala ti brate! Puno si pomogao :)

  • @sharafatali3203
    @sharafatali3203 3 ปีที่แล้ว

    Nice teaching style

  • @МаксОгн
    @МаксОгн 2 ปีที่แล้ว

    Thank you so much!

  • @sharafatali3203
    @sharafatali3203 3 ปีที่แล้ว

    Nice teaching style

  • @amksprofa3110
    @amksprofa3110 4 ปีที่แล้ว

    where did you get R.array from, its complaining about array

    • @StevdzaSan
      @StevdzaSan  4 ปีที่แล้ว

      Rebuild your project, or close Android Studio and run it again.

  • @omegaalpha5702
    @omegaalpha5702 4 ปีที่แล้ว

    thank you so much, all my recyclerviews crashed, your tutorial helped me

  • @BiGGeSMK
    @BiGGeSMK 3 ปีที่แล้ว

    Thank you :) great job ;)

  • @felipearavena6554
    @felipearavena6554 3 ปีที่แล้ว

    Very helpful !!

  • @marcinbiaecki9731
    @marcinbiaecki9731 3 ปีที่แล้ว

    Thank you :)

  • @helenh2442
    @helenh2442 4 ปีที่แล้ว

    for me it only shows one card view???? I have changed my_row.xml: android:layout_height="wrap_content". Can someone help me

    • @fabianramirez338
      @fabianramirez338 4 ปีที่แล้ว +1

      try to slide your screen all the way down, they are down there, happen to me to...

    • @wtmftproductions
      @wtmftproductions 4 ปีที่แล้ว +1

      @@fabianramirez338 I had the same issue. Thanks!

  • @pajeetsingh
    @pajeetsingh 3 ปีที่แล้ว

    Nice mascot.

  • @elaabaj6627
    @elaabaj6627 4 ปีที่แล้ว

    Thank you very much! That was very clear and easy to understand

  • @infomines
    @infomines 4 ปีที่แล้ว

    the distance between the items is showing far why ??

    • @StevdzaSan
      @StevdzaSan  4 ปีที่แล้ว

      Check your row layout file. Root layout should have a height attribute of wrap_content instead of match_parent.

  • @soso-po1nj
    @soso-po1nj 4 ปีที่แล้ว

    thank you so much :) your video help me a lot

  • @sichen9335
    @sichen9335 4 ปีที่แล้ว

    I FAKING LOVE YA MATE

  • @eddyhansandrianambinina5907
    @eddyhansandrianambinina5907 4 ปีที่แล้ว

    Thank u very much

  • @theblindprogrammer
    @theblindprogrammer 3 ปีที่แล้ว

    really clear. Thanks.

  • @8vbo130
    @8vbo130 4 ปีที่แล้ว

    How to make recyclerview item with a Spinner?

  • @yousefbaghlaf6713
    @yousefbaghlaf6713 3 ปีที่แล้ว

    Great video

  • @HyperActive94
    @HyperActive94 4 ปีที่แล้ว

    great tutorial thnx for it.