Simple ListView creation in android

Alterations required

Today I’m going to describe how newbies can make a ListView in the easiest way i know so far.

There are quiet a lot of ways you can create a ListView in android. The easiest way: Populate the items from the string resource via an ArrayList.

In this post the bold codes are the ones which you need to make the listView fully functional.

The italics are the hints on what the code is used for.

You can find the string resource from: your project>res>values>strings.xml That is if you are using Eclipse.

In the string.xml type in the following code:

Feel free to add more items if you want.

Now in the Activity where you want to show the ListView write the following code:

This will declare a ListView in your UI (User Interface) which will cover the whole parent layout. If you want you can change some settings to your…

View original post 222 more words

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s