Aaron Bell
Aaron Bell

Reputation: 25

Android Studio - 2 string arrays into listview

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!

Upvotes: 1

Views: 241

Answers (1)

KDeogharkar
KDeogharkar

Reputation: 10959

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 :)

Upvotes: 2

Related Questions