0

This is a new Activity where I read some user input.

So when I click the ADD BUTTON I want to get the two user input and show them in a ListView which is in a different activity. So I want the user input to be displayed in the following ListView (Title in Heading, Password in sub heading of listView):

m00am
  • 5,910
  • 11
  • 53
  • 69
Sudeep G
  • 3
  • 2
  • Somehow unclear question though, do you want to have a single item in a listview having a title and a password only? As listView is a scrollable representation of a collection of data (similar in nature) and as i've analyzed, you can't have a collection with only two input fields unless you save the entries so that they could be used later. – Maddy Blacklisted Jan 26 '18 at 05:55
  • Yeah i want to have a listview which could display a title and password as title and subtitle. Further more lets say i have four inputs in my activity, and when user clicks add then i want to display the the ttlle only in my listView and when i click the title in the (ListView) it could display all the four inputs in another activity.This is the thing i want . Could you help me? – Sudeep G Jan 26 '18 at 06:50

1 Answers1

0

Say we create a class for clsItem containing the Item and SubItem. Then, we create an arraylist of clsItem in which we can add those items whenever the button is clicked. From there, we can set the adapter for our listview. Below is just a sample:

List<clsItem> items = new ArrayList<>();
objects.add(new MyType());

ItemsAdapter adapter = new ItemsAdapter(this, items);
ListView listView = (ListView) findViewById(R.id.lvItems);
listView.setAdapter(adapter);

Please have the luxury to change. Thanks. Kudos!

Peter Saul
  • 64
  • 6
  • Thanks It helped me a little bit somehow . I will verify this. – Sudeep G Jan 26 '18 at 06:55
  • Also to store those inputs permanently, I have to use SQL Database ?? – Sudeep G Jan 26 '18 at 06:56
  • yeah. much better. – Peter Saul Jan 26 '18 at 07:18
  • Hey thanks for helping I wonder if you will help me more. Further more lets say i have four inputs in my activity, and when user clicks add then i want to display the the ttlle only in my listView and when i click the title in the (ListView) it could display all the four inputs in another activity.This is the thing i want . Could you help me? – – Sudeep G Jan 26 '18 at 07:31
  • where do you want to display those four inputs? – Peter Saul Jan 26 '18 at 07:57
  • After adding the 4 inputs when i click the listview , i want it to be displayed in a seperate activity.. – Sudeep G Jan 26 '18 at 10:06
  • Hi @SudeepG . I wasn't able to respond to you these past few days. Can you like state the user story of how things will work in the GUI? Thanks. – Peter Saul Jan 30 '18 at 07:58
  • I have developed my program as on the video https://www.youtube.com/watch?annotation_id=annotation_3065812653&feature=iv&src_vid=SK98ayjhk1E&v=aQAIMY-HzL8 – Sudeep G Jan 30 '18 at 08:35
  • If you cna view this link then my half problem is solved. In this video, one input is passed and displayed in another activity list view. But i want to pass different inputs(lets assume 4 inputs (TITLE – Sudeep G Jan 30 '18 at 08:39
  • can you like pass as a single object containing multiple data / information? – Peter Saul Jan 31 '18 at 02:35
  • N i have only passed a single data only But I want to pass a single object having multiple info Help me – Sudeep G Jan 31 '18 at 14:39
  • what are the parameters that you specify in your new activity? – Peter Saul Feb 02 '18 at 04:43
  • hi @SudeepG have you tried using bundles. i saw [this](https://stackoverflow.com/questions/768969/passing-a-bundle-on-startactivity) link that might help you regarding passing multiple values to another activity. – Peter Saul Feb 06 '18 at 02:07