List View App Android Studio Tutorial Using Custom Adapter

Поділитися
Вставка
  • Опубліковано 2 лис 2024

КОМЕНТАРІ • 37

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

    Somehow i found your channel, useful tutorial for me, i wish you have better future on your channel. Thanks for the tutorial!

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

      Thanks. Glad you found some use in the tutorial :)

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

    thanks man, you helped me a lot in college with this video.

  • @yourfingeronscreen8598
    @yourfingeronscreen8598 3 роки тому +2

    Your tutorials are great, a sunshine ray of java through all that Kotlin stuff on all the Internet. At universities in general, they require java a lot. All I know I learned from your channel, thanks!

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

    Thank you so much, I really really appreciate that, keep up the good work bro :)

  • @Lucee220
    @Lucee220 Рік тому

    @CodeWithCal Great tutorial! My listview loads up perfectly but the onclick is not working when I select an item from the list, instead, the program crashes. I've looked at the other .java files and I can't find any issues. Would you mind taking a look at my code?

  • @rabiulhasannayan8220
    @rabiulhasannayan8220 3 роки тому +2

    very effective tutorial.if you continue like this, your channel will grow a lot
    some thing to improve.
    1. audio quality(it seems like you using computer built in microphone to record).
    2. plz zoom the text.so that it more viewable.

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

    Sir thank you soo much sir! great work! i will share it with all my friends!

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

    Great tutorial, it really helped. Every thing loads fine the first time the activity is ran, however if I go to another activity then return the list is doubled. How can I save the progress on a page so it is the same each time I load it?

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

    Thanks a million Cal for the outstanding tutorial. Works like a charm!!
    I just have one question, when scroll down the listview and click on any item (item number 30 for example) , it goes to its detailed activity perfectly. But when i get back to the listview again, the list starts all over from the beginning (from item number 1), not from the item which I clicked. Is there a way to do that? That would be really appreciated.

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

      Glad you liked the tutorial 🙂
      If you made the cell height fixed say for example 100dp.
      Currently if the user selects say item 30 you'll pass the item via the intent into detail activity. What you'll need to do is override the onbackpressed method on the detail activity and pass that item back to to the list view activity via an intent I'm pretty sure is possible.
      then calculate to set the scroll view position say 30 times 100. Then set the listview scroll view.
      I haven't done it myself so some of my assumptions may be incorrect. But give it a go and if you have any dramas let me know

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

    Hi! At 10:52 you went over the OnClickListener about booting up a new activity on click, and I'll like to ask, I'll like to modify each different shape to link to a different type of activity every time, for example, clicking the triangle would open up Activity1.java, with the hexagon opening up Activity2.java with vastly different content.
    How would I go about modifying the OnClickListener to do this? Thank you so much in advance.

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

      So in onItemClick()
      You could open different activities based on the shape name
      so below
      Shape selectShape = (Shape) (listView.getItemAtPosition(position));
      if(selectedShape.name.contains("Circle"))
      {
      // circle intent
      }
      else if(selectedShape.name.contains("Square"))
      {
      // square intent
      }
      else
      {
      // default click action
      }
      Is that what you are after?

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

      @@CodeWithCal Yes, it took a bit of tweaking, but thank you so much! I can continue with my project now.
      If anyone in the future needs it, here's my slightly edited code:
      private void setUpOnClickListener()
      { //go to another page
      listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
      @Override
      public void onItemClick(AdapterView parent, View view, int position, long id)
      {
      Shape selectShape = (Shape) (listView.getItemAtPosition(position));
      if(selectShape.name.contains("Circle"))
      {
      // circle intent
      Intent showDetail = new Intent(getApplicationContext(), myclassname.class);
      startActivity(showDetail);
      }
      else if(selectShape.name.contains("Square")){
      // square intent
      Intent showDetail2 = new Intent(getApplicationContext(), myclassname2.class);
      startActivity(showDetail2);
      }
      else{
      // default click action
      println("Howdy"); //this can be whatever you want
      }
      }
      });
      }
      Also, you may need to change in Shape.java
      private String name;
      to
      public String name;
      for this to work, just a disclaimer as I've only been up to Part 2 of this tutorial so I won't know if this change may affect the later tutorials. (All of Part 2 still works otherwise)

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

      @@Seafairlynn Great work ☺️

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

    Hi Cal, do you happen to know why my listview is duplicating cells ? thanks a lot

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

      The code that populates the list is probably being called more times than you are hoping for. Put in a break point and run in debug mode to see how many times it is called

  • @m-j-y8289
    @m-j-y8289 3 роки тому

    Could you do a video where you show how to add and delete things from the list as well?

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

      ua-cam.com/video/4k1ZMpO9Zn0/v-deo.html
      Maybe a bit more than what you asking for. But check out the SQLite tutorial, we delete items from the list in this tutorial.

    • @m-j-y8289
      @m-j-y8289 3 роки тому

      @@CodeWithCal Thanks will do!

  • @johnlloydescaño
    @johnlloydescaño Рік тому

    i have a problem. when i click view it show "building name" and no image. please help me

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

    How do I create an action to open a new activity when I click on an item in the list?

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

    Thanks

  • @Asma-od1vf
    @Asma-od1vf 3 роки тому

    Hi cal ..
    I try to write your code but i need your help to resolve my problem please am student and i really really need your help

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

      Sure, I'll give it a go. Whats the problem?

    • @Asma-od1vf
      @Asma-od1vf 3 роки тому +1

      @@CodeWithCal thank u so much ...
      The problem when I press in shape_cell the app is stopped suddenly..
      I do not know what is problem ?

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

      @@Asma-od1vf you should be getting an error message in your console.
      Open up the console and look for something with the term exception in it then google that :)

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

    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.

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

      Bonjour.
      Google translate lead me to believe you're trying to build an expandable list view?
      www.journaldev.com/9942/android-expandablelistview-example-tutorial
      Hope this helps. Merci, mon ami.

    • @MK-hu8kc
      @MK-hu8kc 3 роки тому

      @@CodeWithCal This made me laugh when i needed it the most after tirelessly finishing Uni work thanks Cal 😂

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

    put your paypal account so I can give you some money if I get the job. thanks for everything, learned a lot, coming from java and definitely android is a lot more abstract than normal java, I will take some time to get use to the built in classes that android studio has.

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

      paypal.me/ccahillapps
      Please feel zero obligation, I'm happy to help for the sake of helping. Good luck, fingers crossed you land the job you are after 🍀🤞

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

    I'm just wondering how are you able to write in this small-sized text??
    Seriously regardless of the viewers!

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

      Thanks for the feedback, I have made the text size bigger in Android Studio for future videos.