for(int i=0; i<jArray.length(); i++) {
HashMap<String, String> map = new HashMap<String, String>();
json_data = jArray.getJSONObject(i);
name = json_data.getString("name");
map.put("id", String.valueOf(json_data.getString("news_id")));
map.put("title",json_data.getString("news_title"));
map.put("shortdescription",json_data.getString("news_short_description"));
mylist.add(map);
}
This my data and i m able to Print data in Listview lv.setAd..(mylist)
But i have to collect all news_title in string array so that i can display news title under so that i can display all data in single line with morqee .
please help me how to store data in string aray . i m new in android
Im not really following your question. A String is an array of chars so umm? That being said, what is the issue exactly do mean you are having trouble with Json or do want to accumlate data into a single string. Not sure exactly what is the problem here. So have 2 seperate ideas based on my limited understanding.
A) Json issue : Getting a string into Json format in Java looks like this:
JsonObject temp = new JsonObject();
temp.addProperty(myString);
then when done adding to the output create your output string
b) If you want to know how to accumlate data into a single string this is also easy
myString = myString + ” ” + newStringData;
but in the json model just keep using