Android Kotlin: Essentials to Creating a ListView (Ep 1)

Поділитися
Вставка
  • Опубліковано 9 лип 2024
  • Creating a ListView is essential for great User Experiences on Android applications. Today we explore the necessary bits and pieces to setup one. More specifically, we need to create our own custom Adapter that provides our ListView with data. Enjoy.
    Android Studio Introduction: • Android Kotlin: Introd...
    Instagram Firebase Course
    www.letsbuildthatapp.com/cour...
    Facebook Group
    / 1240636442694543
    iOS Basic Training Course
    www.letsbuildthatapp.com/basi...
    Completed Source Code
    www.letsbuildthatapp.com/cour...
    Follow me on Twitter: / buildthatapp

КОМЕНТАРІ • 138

  • @ianschoenrock2285
    @ianschoenrock2285 5 років тому +1

    Easily the best Android videos on youtube. I love it thanks for the great content!

  • @Yasinaktimur
    @Yasinaktimur 4 роки тому +1

    youre very professional and we love you thx for them all.

  • @user-hi1iz7qe8z
    @user-hi1iz7qe8z 6 років тому +1

    thanks for uploading awesome video!
    I've been waiting for your android lesson

  • @user-uv4ii4dh2m
    @user-uv4ii4dh2m 4 роки тому

    thank you so much!!!! i been looking so much for good listView tutorial!!!!

  • @literallyshane4306
    @literallyshane4306 6 років тому

    Excellent as usual! thank you

  • @sameerk12982
    @sameerk12982 6 років тому +1

    Thank you Sir for making such an easy and clear tutorial. The way you explain things are very clear.

  • @manuelcoliano1101
    @manuelcoliano1101 5 років тому +17

    hey, sound is imbalanced... The left channel is way quiter than right channel

  • @rogerwprice
    @rogerwprice 6 років тому

    Thanks. Interesting stuff!

  • @user-ci2ll3us8j
    @user-ci2ll3us8j 6 років тому

    Thank you so much! Really useful videos!

  • @serbaserbi9709
    @serbaserbi9709 6 років тому +1

    thanks for you tutorials bro, when i was learn IOS programming i also watch and learn from you. Im your fans. keep moving. chers

  • @thanasisathanasi4965
    @thanasisathanasi4965 4 роки тому

    Old Video but really good. Face and Voice of the author. Good illustration, good microphone. Yes definitely a like !. Thank you sir !

  • @thananut
    @thananut 6 років тому

    another awesome tutorial cheer

  • @dynsta
    @dynsta 6 років тому

    Parabéns pela aula, ótima explicação... Obrigado

  • @mandara88
    @mandara88 6 років тому

    Best tutorial on the net!

  • @clutchSoda
    @clutchSoda 6 років тому

    man, thanks for doing android tutorials you are awesome!

  • @boris138
    @boris138 6 років тому +15

    When you're setting a value for a property in constructor, you don't need to use init block, you can just declare your property inside a constructor like this
    class ClassName(val property: Type)

    • @LetsBuildThatApp
      @LetsBuildThatApp  6 років тому +2

      Oh you're right, I'm still stuck in the Java mindset of doing things!

    • @daitedve1984
      @daitedve1984 6 років тому

      You can, but don't have to. You must not to! It's bad practice, leading to muddy code.

    • @skir2039
      @skir2039 6 років тому

      its not bad practice. It is purposelly put into Kotlin to prevent the boilerplate code

    • @chrisumb
      @chrisumb 6 років тому

      "bad practice" no.. no...
      You can also use access modifiers like private, public, and package-private inside the constructor.

  • @deven5578
    @deven5578 6 років тому +1

    lets build+ sir can i use android studio in my laptop having 1 gb ram if not how can i increase my ram

  • @craigmunday3707
    @craigmunday3707 6 років тому

    Nice lesson, very clear

  • @beneditomauroo
    @beneditomauroo 6 років тому +1

    Hi Brianm is there any chance that you will do a swipe menubar couser (free or paid) for android?
    Thank you

  • @sukram1998
    @sukram1998 6 років тому

    How do I know when I should swap from ListView to RecyclerView or the other way?

  • @raj-kal
    @raj-kal 6 років тому

    thanks for the awesome tutorial

  • @krutomjer
    @krutomjer 6 років тому +3

    Thanks for the tutorial Brian. Coming from Xcode and iOS I have a love/hate towards android studio :)

  • @pathakvivek7865
    @pathakvivek7865 6 років тому +17

    thank you for Android tutorials...
    its nice to have Android tutorials from you...
    hope ti will be continuining in comming videos also..

    • @LetsBuildThatApp
      @LetsBuildThatApp  6 років тому +5

      We'll slowly have more and more Android related content on this channel for all of your starving out there.

    • @sashakolsky
      @sashakolsky 6 років тому

      Lets Build That App thanks for the videos. I wonder whats you take on react native replacing kotlin/Java and swift/objective-c? Isn't that the direction where it's all heading?

    • @pathakvivek7865
      @pathakvivek7865 6 років тому

      Thank you very much ...
      and it would be better if you start a series of complete app developing tutorials...

    • @LetsBuildThatApp
      @LetsBuildThatApp  6 років тому

      This was supposed to happen 10 years ago according to predictions in the software industry.

    • @LetsBuildThatApp
      @LetsBuildThatApp  6 років тому +1

      You can go ahead and sign up for an account on my website and I'll announce when a full series course comes out for Android Kotlin. Thanks.

  • @vvyogi
    @vvyogi 6 років тому

    Awesome tutorial.

  • @oORodryOo
    @oORodryOo 6 років тому

    Hi, I'm doing it like this
    var listado = Array(2,{"a"})
    var adaptador = ArrayAdapterr(this,android.R.layout.simple_list_item_1,listado)
    lista.adapter = adaptador
    its the same? or is better do it like you?

  • @nicosolis2810
    @nicosolis2810 6 років тому

    Hi Brian, just a few question. How will you differentiate ListView vs RecyclerView and which is much better for you? Like how you define the differences of TableView & CollectionView in SWIFT. Thank you in advance. :)

  • @ToastBrot4444
    @ToastBrot4444 6 років тому +1

    Hadn't even realized you have Android videos aswell - is this the first? Looking forward to watching it!

    • @Abdi-uy1kh
      @Abdi-uy1kh 6 років тому +1

      There is 2 other videos

  • @mc.jacksonz
    @mc.jacksonz 6 років тому

    HELLO BRIAN,can I ask now Apple device can restore without upgrading IOS? Currently on IOS 9 .

  • @Estraus96
    @Estraus96 5 років тому

    anyone can help me pls, I am trying to develop a Full piano, by means of fragments, with structure MVVM and LiveData (targetveb.com/android-piano-kotlin-mvvm-livedata.html), but I do not know how to put more than two fragments in one ListView or a RecyclerView, how should I use the adapter to work properly and move me around the keyboard?

  • @yasithaherath5786
    @yasithaherath5786 4 роки тому

    Thanks man

  • @joca251078
    @joca251078 6 років тому +1

    Hey Brian, thank you for this tutorial and all content that you do about iOS developer. I have learning a lot with you.

  • @educatorestrada29
    @educatorestrada29 6 років тому

    I have a listView that does not run. I don't know what to do at this moment. I have tried everything. Please help.
    Lost in programming
    Margarita

  • @penguimTwo
    @penguimTwo 4 роки тому

    Anybody have any idea how to add the grey colour to once every 2 itemViews like in the thumbnail?

  • @3107SatoPandaxSamurai
    @3107SatoPandaxSamurai 5 років тому

    So im new to android studio, I decided to create a listview similar to yours therefore I took the liberty and used the exact code you showed in the video but to my shock , the code doesnt work at all , nothing shows up on the list view , the val function doesnt even work only has error and yeh I was wondering whether you could kinda help me out with my listview since its not working for me at all

    • @LetsBuildThatApp
      @LetsBuildThatApp  5 років тому

      I’ll be putting up an updated paid course on my website later this year. You’ll find better code there.

  • @jakekudur2263
    @jakekudur2263 5 років тому

    Hi Brian! Could you make video on using MVVM with retrofit, realm(or ant other data base), livedata on kotlin. Thanks.

  • @valeria-210
    @valeria-210 6 років тому

    thanks for the tutorial ... in the demo that you use to explain what you are going to teach in the navbar there is a search engine ... that at some point you show it how it is done? I did not see it in this tutorial ... Thank you!

  • @joycelu962
    @joycelu962 6 років тому

    Super!!

  • @Hamzaelbouti
    @Hamzaelbouti 2 роки тому

    love ur tutorials
    .... do jetpack compose tutorial plz ...

  • @FadhlyHamzah
    @FadhlyHamzah 3 роки тому

    Subscribed

  • @darkpawn5563
    @darkpawn5563 3 роки тому

    большое спасибо за видео

  • @pyroandi6797
    @pyroandi6797 4 роки тому

    I always get a typecast error in the exact same line in the getView() method no matter what i do 😖

  • @barche75
    @barche75 6 років тому

    Hi Brian. As Kotlin compatible with Java, and Java can run on any OS where JVM is installed. Can i use Kotlin to create apps for Windows? If it’s possible, can you make video about that? Thanks a lot!

  • @top10tips61
    @top10tips61 5 років тому

    nice

  • @hrulekhnandan5293
    @hrulekhnandan5293 3 роки тому

    So do we get unlimited number of list view or is it only 5?

  • @tiagoalexbastos
    @tiagoalexbastos 6 років тому

    Hey Brian! I've got something to ask you. Why do you use findViewById on Kotlin? Kotlin can get de UI element by itself if you just give the ID declared on the layout file.
    like this:
    val listView = main_listview
    But I bet you know this, so, is there any benefit in using findViewById in Kotlin ? Or it's just your personal preference.

    • @LetsBuildThatApp
      @LetsBuildThatApp  6 років тому +2

      +Tiago Bastos yeah I read about this but wasn't able to get it to work. It's also helpful to go over things the long way first

    • @tiagoalexbastos
      @tiagoalexbastos 6 років тому

      Yeah, you're right :)

    • @LetsBuildThatApp
      @LetsBuildThatApp  6 років тому +2

      Ok, I finally figured it out, hopefully I'll be able to show this in a later video.

  • @robinmendoza4784
    @robinmendoza4784 5 років тому

    Hi, how to retrieve image from firebase using Kotlin?

  • @11m0
    @11m0 6 років тому +1

    Keeping reference to a context sounds like a recipe for memory leaks

  • @mixedmashup778
    @mixedmashup778 6 років тому +1

    Hello sir,
    I want listview to open a new activity and display certain information when clicked in certain row of listview. So far i am only able to display same information when clicked on every row . i dont know how to set these information for particular row for example when i click on row 1 the details of mobile are shown have textView and when i click on row 2 mobile price is shown
    Sir plz help me out.

    • @LetsBuildThatApp
      @LetsBuildThatApp  6 років тому +1

      You just want to use putExtra on your intents.

    • @mixedmashup778
      @mixedmashup778 6 років тому

      Lets Build That App
      Yes sir
      But how we will display different information in one activity.
      Thank you sir for replying 😊

    • @LetsBuildThatApp
      @LetsBuildThatApp  6 років тому

      Check out the next series where we build out these features: ua-cam.com/video/SamS4UA-b4Q/v-deo.html

    • @LetsBuildThatApp
      @LetsBuildThatApp  6 років тому

      What does google say?

    • @mixedmashup778
      @mixedmashup778 6 років тому

      Lets Build That App
      This is the code which I m trying and Google said.
      protected void onListItemClick(ListView lv, View v, int position, long id){ super.onListItemClick(lv, v, position, id); Intent intent = new Intent(StudentHall.this, StudentHallSelect.class); switch(position){ case 0: intent.putExtra("description",getResources().getStringArray(R.array.hallsdescription)[0]); break; case 1: intent.putExtra("description",getResources().getStringArray(R.array.hallsdescription)[1]); break; } startActivity(intent); }

  • @genesisbriones2413
    @genesisbriones2413 4 роки тому

    Good morning, can you do a tutorial for Table Registration/Reservation App.
    Like this.
    * 4 tables - grid
    * 5 pax per table
    if table is clicked - Show customer list

  • @doktoren99
    @doktoren99 4 роки тому

    Parameternames such as p0... pn is pretty useless. No offense but android studio autocompletion seems to be absolute garbage from my experience. Is there a way to get proper autocomplete, close to what xcode offers? Brian says the autocomplete is not working "for some reason". Would that imply that it usually works differently?

    • @LetsBuildThatApp
      @LetsBuildThatApp  4 роки тому

      The autocomplete has gotten better over the years. Pretty soon we can utilize Jetpack Compose to draw out all the UI. Lists will be a thing of the past.

  • @blexyt3485
    @blexyt3485 6 років тому

    which brand mic do you have

  • @TheCreative1798
    @TheCreative1798 3 роки тому

    if only my teacher could explain the problem like you do

    • @LetsBuildThatApp
      @LetsBuildThatApp  3 роки тому

      True, most teachers are absolutely not fit to be teaching.

  • @zhangjinxin1308
    @zhangjinxin1308 4 роки тому

    How to use fragment

  • @ultimat.
    @ultimat. 3 роки тому

    Bonjour, je sais pas si vous allez pouvoir me donner l'info. J'ai créé une liste view et je croyais pouvoir attacher une autre liste wiew mais je n'y arrive pas. Mon projet et de présenter des articles de péche et pour cela j'ai besoin de créer des catégories exemples A1) matériels de pêche et B1) matériels vêtements de pêche sous catégories Aa1 accessoires de pêche les bouchons Ab1 les apats Ac1 les Cannes à pêche.... et une dernière sous catégorie Aaa1 les bouchon bois Aaa2 les bouchons pvc Aaa3 les bouchons..... Et après la fiche de l'article. Comment procéder. J'ai cherché et rien trouvé si vous pouviez m'orienter ou me donner une source ou autre je suis preneur. Merci beaucoup par avance.

  • @LifeCasts
    @LifeCasts 6 років тому

    Thanks, finally tutorials about Android, Are you going to explain all the layouts and widgets, like ListView, RecyclerView etc, or it will be project based?

    • @LetsBuildThatApp
      @LetsBuildThatApp  6 років тому +2

      I'm probably going to do an intro on the basic components I need for the first project, then move onto writing some real project code.

    • @LifeCasts
      @LifeCasts 6 років тому

      Ok great, thanks:)

  • @shayan_ecksdee
    @shayan_ecksdee 6 років тому +5

    which keyboard do you use?

    • @japhethjay4880
      @japhethjay4880 5 років тому

      Why does he not want to answer this question but my guess will be a mac keyboard maybe the one on the laptop

  • @nizz4m
    @nizz4m 6 років тому

    Brian, can you disable the device frame on emulator ? Look pretty neat :)

    • @LetsBuildThatApp
      @LetsBuildThatApp  6 років тому

      Thank you for the suggestion! I really hate the frame.

  • @bytler4518
    @bytler4518 6 років тому

    please tab layout or recyclerview !

  • @aaqibjavaid3472
    @aaqibjavaid3472 6 років тому

    Can you do quick video on AdvanceWebview ? Please I converted my website to an app but I cant download any file like video and music. Please help me how to do that. Thnak you so much

    • @LetsBuildThatApp
      @LetsBuildThatApp  6 років тому

      That's great, how would you like the solution presented?

    • @aaqibjavaid3472
      @aaqibjavaid3472 6 років тому

      Lets Build That App anything can work at this time. A video or even through chat. Please help me out

    • @aaqibjavaid3472
      @aaqibjavaid3472 6 років тому

      I am using this > github.com/delight-im/Android-AdvancedWebView
      problem is when I click on download button it doesn't do anything

    • @SaurabhKumar-om5pd
      @SaurabhKumar-om5pd 6 років тому

      Lets Build That App
      Hey Brain, This tutorial is really awesome, easy to understand and implement. As I am new to Android development could you come up with a video where you can show Collection View functionality implemented in Android.

  • @francorojas7372
    @francorojas7372 5 років тому

    Thanks Brian. Are you planning to update this tutorial videos?

    • @LetsBuildThatApp
      @LetsBuildThatApp  5 років тому

      What's there to update?

    • @francorojas7372
      @francorojas7372 5 років тому

      @@LetsBuildThatApp for example I just read in the comments below that is better to use RecycledView instead of ListView (for something of the ViewHolder) and that you don't need to use init block, you can just declare your property inside a constructor like this
      class ClassName(val property: Type)
      I just updated like this: private class CustomAdapter(val context: Context): BaseAdapter()
      So just to be sure to use kotlin benefits

    • @LetsBuildThatApp
      @LetsBuildThatApp  5 років тому

      There’s already a ton of recycler view tutorials on this channel. I suggest you go through those as well.

  • @joaovictorsouza3560
    @joaovictorsouza3560 4 роки тому

    Hello! Nice videos! One suggestion: In 17:30, instead of Init{} you can use "val" before the variable to be able to use it on the class.

  • @patrickwaterman4959
    @patrickwaterman4959 6 років тому

    great video bro, how can I see user name and password on a save pokemon go backup apk? I lost my password and user name to login

  • @dxvfdfx
    @dxvfdfx 6 років тому

    It's kotlin now and why still use findviewById ?

    • @LetsBuildThatApp
      @LetsBuildThatApp  6 років тому +1

      Yeah, the next couple of videos I show how to avoid findViewById.

  • @sophiemccarthy1341
    @sophiemccarthy1341 6 років тому

    Isn't Java still better than Kotlin atm? I've heard there are very few resources for Kotlin. Let's say if somebody wanted to learn android app development, wouldn't it be better to start with Java. I don't see Kotlin taking Java's place anytime soon.
    Btw, are there a lot of syntax changes between swift 3 and 4? I'm learning swift 3 right now thus I was wondering if I'll be able to swiftly transition my projects to swift 4? There were quite a few drastic changes in the past between swift 1, 2, and 3.
    PS. I love your channel.

    • @LetsBuildThatApp
      @LetsBuildThatApp  6 років тому +3

      Hello Sophie, I would highly encourage you to get out of the mindset of finding the "BEST" language out there. End of the day, all of the programming concepts are the same and can be transferred over quite easily. Good luck.

    • @tua24262
      @tua24262 6 років тому

      Kotlin is 100% interoperable with Java so all Java resources are available in Kotlin. Now that Google has provided first class support for Kotlin in Android development it is very likley that it will be the de facto language in due time.

    • @sophiemccarthy1341
      @sophiemccarthy1341 6 років тому

      Sounds great. It's just a pain in the neck for rookie developers, myself included, who'll be forced to learn two languages now to develop apps on a single platform :/. Google could've used swift instead since it's open-source.

    • @LetsBuildThatApp
      @LetsBuildThatApp  6 років тому

      Indeed, however this is like going into the ice cream shop for the first time and saying "There are way too many flavors, I wish you guys would just sell vanilla! I'm so confused."

    • @tua24262
      @tua24262 6 років тому

      But that's the great thing about Kotlin, Sophie. You don't necessarily need to learn it. Some of your team can use Kotlin while you use Java and they both work well together. Learn Java first because I think it helps learning a more verbose approach first. Then when you're comfortable, learning Kotlin will be a breeze.

  • @gpj-qo9cb
    @gpj-qo9cb 6 років тому

    It seems like Kotlin is throwing you off haha. I much prefer Java with Kotlin sprinkled in - don't think I'll be a fan of Kotlin when Java is around. Maybe you could do that? Seems like the workflow currently adopted in the industry.

    • @LetsBuildThatApp
      @LetsBuildThatApp  6 років тому

      +Josh Gallagher yeah kotlin is certainly harder to explain since I'm not really used to it, however it is a true pleasure to type and code in it. Kotlin and intellij is blazing fast. I think going forward we will see more and more adoption of kotlin. Slowly the Java docs will morph into kotlin as well just like swift.

  • @ssswdon
    @ssswdon 6 років тому

    put a val before context and it will create a field for you.

  • @educatorestrada29
    @educatorestrada29 6 років тому

    I am using android 3.0.1

  • @ssswdon
    @ssswdon 6 років тому

    if you just have a return you don't need the return type and block

  • @dinobudic4492
    @dinobudic4492 5 років тому

    No need for find by id in kotlin

  • @marlonvonansale6457
    @marlonvonansale6457 5 років тому

    I think it is better to use recycler view

    • @LetsBuildThatApp
      @LetsBuildThatApp  5 років тому

      It still boggles my mind that people don’t know that recycler view is a list view with view holder implemented

  • @albertlu8407
    @albertlu8407 6 років тому

    Android :D

    • @LetsBuildThatApp
      @LetsBuildThatApp  6 років тому +1

      Yeah gotta love android.

    • @albertlu8407
      @albertlu8407 6 років тому

      How's the 上海 trip?

    • @LetsBuildThatApp
      @LetsBuildThatApp  6 років тому

      +Albert Lu it was super hot and fun teaching

    • @albertlu8407
      @albertlu8407 6 років тому

      Ha ha, It's nice to have you back!
      I'll love android definitely :D

  • @thecynster5625
    @thecynster5625 4 роки тому

    There needs to be more educational videos with good production quality

  • @barefeg
    @barefeg 6 років тому

    One person doesn't understand lambdas

  • @stevejobs5919
    @stevejobs5919 5 років тому

    why teach something that will never be used? was this a lazy upload?

    • @LetsBuildThatApp
      @LetsBuildThatApp  5 років тому +1

      Why teach math when we have calculators?

    • @peternatoli5164
      @peternatoli5164 5 років тому

      My guy programs and burns people at the same time lul.

  • @help-ever
    @help-ever 6 років тому

    Oh god, way too old method.

    • @LetsBuildThatApp
      @LetsBuildThatApp  6 років тому

      Go ahead and catch up on the latest Android Kotlin series where we go through RecyclerView.

  • @raemrahman8898
    @raemrahman8898 5 років тому

    booooooooooooooooooooooooooooooooooooooooo

  • @jackblack5552
    @jackblack5552 6 років тому

    Since we have RecyclerView there is no reason to use Listview :)

  • @nabeel3667
    @nabeel3667 3 роки тому +1

    What the hell is this, just a waste of time.

  • @ZulqurnainCodingDiaries
    @ZulqurnainCodingDiaries 6 років тому

    List View? what are you ! 12? , use a recyclerview

    • @LetsBuildThatApp
      @LetsBuildThatApp  6 років тому +2

      I hope you realize recyclerview is just a listview with view holder pattern. If you don't know how a list view works, then recyclerviews don't make sense.

    • @InfamousBlackGuy
      @InfamousBlackGuy 6 років тому

      If you stare at it long enough it'll make sense. /s