Android how to display the contents from array in simple method?
i'm trying to list the item in array using listactivity but the contents are in server, and also i need to get that val开发者_运维百科ues to array and display that in listview. Can anyone know this method?
To show data from an array in a list view, you need to use an array adapter:
http://developer.android.com/reference/android/widget/ArrayAdapter.html
For that you need to implement web service call , retrieve the response from the same and then need to parse it either by using XML PullParser, SAX Parser, DOM Parser. Once you are done with parsing the response, you just need to display it inside the ListView or whatever you wants.
Try using:
echo '<pre>'.print_r($array, TRUE).'</pre>';
Where $array is your array.
精彩评论