I'm attempting to use a JSON output from my blog. I'm getting the last 10 posts from my WordPress site and I'm able to get the data from it successfully in android and set it to a TextView
. So I'm sure all of my networking works. Now, I need to make this a master detail layout. So in my master layout all I want to do is list the post_title, and in the detail I want to list the post_content. So this means I have to create an adapter. Where I'm getting confused is, what kind of adapter is the best to use? I'm not sure what kind of object I should use.
Below is my code that I use to get 1 of the post_titles and the post_content. Can anyone give me any direction on this? I was thinking that I could just use an ArrayList to hold post_titles, and another arrayList to hold post_content, but the post content can be very large. I was wondering if anyone could point me in the right direction?
I'm attempting use cwac-endless adapter so that I can load more blog posts, but it's just a wrapper. So I'm still stuck with creating my original adapter, and I'm still unsure of how to implement it.
public void parseJson(JsonObject result){
JsonObject jsonPost = result.getAsJsonArray("posts").get(0).getAsJsonObject();
String title = jsonPost.get("title").getAsString();
String content = jsonPost.get("content").getAsString();
}