1

I have 2 EditText boxes - one for title and one for description. I'm looking to convert whatever the user enters in both into Strings then store them in 2 String Arrays when the post button is clicked.

Then I want to send the two Strings that are in the Arrays current positions to a vertical ListView so that the title sits above and the description below.

The aim is to be able to keep adding posts (title + description) to the ListView.

I have been trying for over 15 hours now so any help would be much appreciated, keep in mind I'm new though!

4
  • 2 string arrays or a string array with two elements? Commented Dec 17, 2015 at 4:00
  • Use custom listView with list item of two textview (title+description) and adapt them with custom adapter from 2 arraylists of string as you want,. Commented Dec 17, 2015 at 4:02
  • Why not use ArrayList<Foo>? Commented Dec 17, 2015 at 4:21
  • You can use getter setter to save all the entered values & you can instantly add the new value to existing arraylist and show that in listview with custom adapter Commented Dec 17, 2015 at 4:56

1 Answer 1

2

Create one Class with both strings like:

Class Foo
{
 private String name;
 private String description;

   // getter setters
}  

Than add instance it in arraylist:

Foo foo = new Foo();
foo.setName("batman");
foo.setDescription("I'm a batman!!!");

yourArraylist.add(foo);

now use this list :)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.