I need help populating a listview from a remote source in android?

If the most you're going to ever have in there is just 3 lines of text, I think a SQLite DB may be a bit much for your situation. I'd look into using a Typed Array Here's a link to the Android Dev Guide on this subject: developer.android.com/guide/topics/resou... Here's a code sample: public class YourListActivity extends ListActivity { String mTestArray; @Override protected void onCreate(Bundle savedInstanceState) { super. OnCreate(savedInstanceState); // Create an ArrayAdapter to contain your items ArrayAdapter adapter; mTestArray = getResources().

GetStringArray(R.array. YourArray); // Assign your array to an adapter with your layout file adapter = new ArrayAdapter(this, android.R.layout. Simple_list_item_1, mTestArray); // Assign the adapter to this ListActivity setListAdapter(adapter); } } EDIT Just realized that your data will be on a remote server, so this approach may not work for you, but it can still give you an idea of how to take your data once received from your remote server and place it into a ListView.

If the most you're going to ever have in there is just 3 lines of text, I think a SQLite DB may be a bit much for your situation. I'd look into using a Typed Array. Here's a link to the Android Dev Guide on this subject: developer.android.com/guide/topics/resou... Here's a code sample: public class YourListActivity extends ListActivity { String mTestArray; @Override protected void onCreate(Bundle savedInstanceState) { super.

OnCreate(savedInstanceState); // Create an ArrayAdapter to contain your items ArrayAdapter adapter; mTestArray = getResources(). GetStringArray(R.array. YourArray); // Assign your array to an adapter with your layout file adapter = new ArrayAdapter(this, android.R.layout.

Simple_list_item_1, mTestArray); // Assign the adapter to this ListActivity setListAdapter(adapter); } } EDIT Just realized that your data will be on a remote server, so this approach may not work for you, but it can still give you an idea of how to take your data once received from your remote server and place it into a ListView.

Thanks for all the reply's. I'm not even too sure if a SQLite database is needed as the actual text itself is just 3 lines and they are only ever going to be 5-6 words per line at the most. Is there an easier way of doing this?

– fuzz Aug 19 at 16:05.

Then the listview will populate. (This is how I imagine:) If you are fetching 3 words then 3 buttons must be number of buttons present in each item of the listview. Overlapping, might scramble the listview.

At the button, you can inflate another layout with "Edit Entry" and "Delete Entry" everytime, item/button of the item is clicked. If you are displaying one piece from the SQL db in each item, there is no need for buttons onItemClickedListener() will do the work.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions