Dynamic listview to get data from user

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Dynamic listview to get data from user



I need to make something like this this



The layout start with only one empty row, then the user can add new empty row by clicking the + button then fill the editTexts with data or can delete that row by clicking the trash button.
Then i need to get all the data the user inserted into an arrayList to insert it in my database.
How can i do that?





What have you done so far?
– mTak
36 mins ago





@mTak I made the item_view.xml and an adapter but remembered that i will have to give it an arrayList to work, and i won't be able to extract the data that the user entered. so basically i done nothing that works
– Toka Ali Amien
33 mins ago







Yes you have to make an arraylist with only 1 empty item which the user must fill with data. This is what you have to do
– mTak
31 mins ago





@mTak okay, but how can i extract the data ?
– Toka Ali Amien
16 mins ago





The user has to type the data somewhere. So create an activity where the user inputs the data and when he presses ok, you add the data to the list, close the activity and refresh the listView. This is just a suggestion.
– mTak
12 mins ago




2 Answers
2



all you have to do is to put a getter method to the ArrayList inside the adapter
then call it from the (fragment|activity) where you initialized the adapter to get the ArrayList with user input :)



if you didn't get let me know to show you a code snippet





I didn't quite get it, the code snippet will be great :D
– Toka Ali Amien
32 secs ago



try it :



get All record and add to (object of array) Arraylist in listAdaper
and use code for send data to db.class in ur listview


DB mDb=new DB();
mdb.fucnionName(YourArraylisy);//send data to db





The problem isn't in putting the data in my database i'm using firebase , i don't know how to extract it from the listview and handle the + button to add a new row
– Toka Ali Amien
6 mins ago






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Visual Studio Code: How to configure includePath for better IntelliSense results

Spring cloud config client Could not locate PropertySource

Makefile test if variable is not empty