• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Help creating a social network layout

cdubs

Newbie
I am creating a simple social network. I am really having trouble on creating a layout to put all the content that a user posts. I am trying to use some type of grid layout or something to display all the posts. Right now I am getting all my information from two arraylists. One arraylist contains the content, the other contains the username that belongs to each post. How can I put these into a nice layout that contains the content with the username under it? Here is what I am doing so far:

private void popPosts(JSONArray jsonArray){
//go through items in array
for(int i = 0; i < jsonArray.length(); i++) {
try {
//get json object
JSONObject json = jsonArray.getJSONObject(i);

//add topic to arraylist
//System.out.println(posts);
contentPosts.add(json.getString(Config.post_content));
userPosts.add(json.getString(Config.post_user));
System.out.println(contentPosts);
System.out.println(userPosts);
} catch (JSONException e) {

}
}
gridView = (GridView) findViewById(R.id.gridView);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, contentPosts);
gridView.setAdapter(adapter);
}

Right now I am just posting the content array not the user. I do not know how to combine them.
 
Back
Top Bottom