1. Download our Official Android App: Forums for Android!

Apps Question about ListView?

Discussion in 'Android Development' started by hello_world, May 26, 2016.

  1. hello_world

    hello_world Lurker
    Thread Starter
    Rank:
    None
    Points:
    16
    Posts:
    3
    Joined:
    May 26, 2016

    May 26, 2016
    3
    1
    16
    Male
    I am learning android app development and I want to make a small app which will take data from 2 text fields (text fields are item and amount) and insert it into a list.

    So this list should have two columns.

    The user can enter any amount of items he wants so the list should be dynamic. He/she should also be able to edit the list while entering data into it.

    Later on (as I keep learning), I want to take each item in this list, and enter it into a Database.

    So my question is, is ListView the best widget which I should use or is there a better/easier one?

    Hope my question is clear. Thanks in advance

     

    Advertisement

  2. LV426

    LV426 I say we take off and nuke this place from orbit
    Moderator
    Rank:
     #11
    Points:
    1,988
    Posts:
    7,849
    Joined:
    Oct 16, 2015

    Oct 16, 2015
    7,849
    11,457
    1,988
    Male
    Software developer
    South West of England
    ListView is ideal for what you want to do.
     
    hello_world likes this.
  3. LightningBolt226

    Rank:
    None
    Points:
    16
    Posts:
    6
    Joined:
    May 26, 2016

    May 26, 2016
    6
    1
    16
    Male
    The ListView is ideal because you can create and configure the views or viewgroups that you want to display as each list item with the use of adapters.
     
    hello_world likes this.
  4. hello_world

    hello_world Lurker
    Thread Starter
    Rank:
    None
    Points:
    16
    Posts:
    3
    Joined:
    May 26, 2016

    May 26, 2016
    3
    1
    16
    Male
    @LightningBolt226 @LV426
    Thanks for your replies.

    Just to clarify, I want to make sure that while entering into the list, the user can click on an already entered List Item and edit it as well. This is possible, right?

    Hope I was clear
     
  5. LightningBolt226

    Rank:
    None
    Points:
    16
    Posts:
    6
    Joined:
    May 26, 2016

    May 26, 2016
    6
    1
    16
    Male
    In your adapter, you can make the views in each list item have an OnClickListener which you can use to listen for when the user clicks on the present List Items. From there, you can decide how you want them to edit the data such as making a dialog where they can input data or some other interface of your choosing.
     
  6. hello_world

    hello_world Lurker
    Thread Starter
    Rank:
    None
    Points:
    16
    Posts:
    3
    Joined:
    May 26, 2016

    May 26, 2016
    3
    1
    16
    Male
    ListView it is... I just wanted to make sure that everything I wanted to could be done using ListView. I didnt want to do the app halfway and then find out that something I wanted couldnt be done on it. Thanks for all your help :):)
     
    LightningBolt226 likes this.

Share This Page

Loading...