3. Add Rows to ListView Dynamically

Поделиться
HTML-код
  • Опубликовано: 27 ноя 2024

Комментарии • 19

  • @humble_roots
    @humble_roots Год назад +1

    I added a couple more columns and managed to get everything saving well but after about 10 items the ListView starts repeating entire entries and the quantity buttons affect both rows. Is this something I'm doing wrong I see on the internet some people say ListView just starts reusing things??? I need to have like a virtually infinite row of stuff it's an inventory app. Will writing my own custom class even help me fix this problem if it's because of the ListView itself? What should I do?

    • @adamthefirst401
      @adamthefirst401 11 месяцев назад

      Did you ever find a solution?

    • @humble_roots
      @humble_roots 11 месяцев назад +1

      @@adamthefirst401 yes it's a bit of a learning curve but you just gotta make it into a recycler view.. hang on a second I'll link you the video that made me suddenly understand the behavior.

    • @adamthefirst401
      @adamthefirst401 11 месяцев назад +1

      @@humble_roots thanks

    • @DancingHippo
      @DancingHippo 5 дней назад

      @@humble_roots Could you link the video if you still have it? Thanks!

  • @mostlydaniel
    @mostlydaniel 2 года назад

    Where is the timestamp to jump to that you mentioned at the beginning?
    EDIT: I found it at 4:28

  • @miles242
    @miles242 3 года назад +1

    how do you have the live design on the right side of your screen?

    • @IJApps
      @IJApps  3 года назад

      When you have an XML file open, you should see three tabs at the top right saying "Code", "Split", and "Design". Make sure to select Split to see both the code and the design.

  • @musfirahnadeem2105
    @musfirahnadeem2105 3 года назад +1

    Hello while typing item.add(item); , 'add' is highlighted in red as an error. I don't know how to resolve this error. Please let me know soon. This is for my final year project. Thanx

    • @IJApps
      @IJApps  3 года назад +1

      You probably made a typo. *items* with an S is the ArrayList. *item* is a String.
      Strings don't have an add function, but ArrayLists do. You may also have named your variables differently so you should check for that.
      What the addItem function does is add a String to an ArrayList.
      In your code you're calling String.add(String) which is not valid in Java.

  • @alexandratrif9213
    @alexandratrif9213 3 года назад +1

    What if my listview has more columns? how can I add a row with values for each column?

    • @IJApps
      @IJApps  3 года назад +1

      To have more "columns" you would need to define a custom layout for each row in your ListView. Each row would have multiple TextViews side by side as the columns.
      Creating a custom ListView layout is covered in the 5th tutorial: ruclips.net/video/aJ8pYAtMdlU/видео.html
      There are multiple steps and the video covers all of them.

  • @ruchitasonawane2226
    @ruchitasonawane2226 3 года назад

    If I enter item and add them and close my app ... After opening this app I want to display previous item ...it means user always login and open app and don't add item repeat and repeat add only once please give me solution

    • @IJApps
      @IJApps  3 года назад

      You would need a way to store the items that the user added. The simplest way to do this is to save the items in the list to a file in internal storage, and whenever you go to the MainActivity, read the items in the file and add them to the ListView.
      These are two tutorials:
      *Writing to Storage: **ruclips.net/video/wc4p6sYR3B4/видео.html*
      *Reading from Storage: **ruclips.net/video/0R3mT6L5F6s/видео.html*

  • @mohammedzaid5063
    @mohammedzaid5063 3 года назад

    How to insert all the list view item to db in a single button click

  • @nelmarkjhonduarte4040
    @nelmarkjhonduarte4040 2 года назад

    what if i my list has image how to add that with the name

    • @IJApps
      @IJApps  2 года назад

      You can check out this tutorial on custom listview layouts: ruclips.net/video/aJ8pYAtMdlU/видео.html
      You would need to have a layout with an imageview, and simply pass the image as a parameter when you add new items to your list.

  • @yuvalsmile1116
    @yuvalsmile1116 2 года назад

    is this java tutorial?