Q: How to display certain rows of data retrieved from the database into a listView I have 2 tables in the database, I joined these 2 tables with their topic_id, using the following query:
SELECT ReplyData.topic_id, ReplyData.reply_user, ReplyData.reply_content, ReplyData.reply_datetime FROM
ReplyData INNER JOIN ForumData ON ForumData.topic_id = ReplyData.topic_id

And the result is: 
Result of the joined table
Now I have a listView, I want to display those data retrieved to the listView. But I want to display some of the data only. For example, in item 1 of the listView, I only want to display the data with topic_id = 36, and in item 2 of the listView, I only want to display the data with topic_id = 37, etc. But I don't know how to do this. I can only display all the items in item 1 and item 2 of the listView, which makes them displaying the same data all the time. It's like a discussion forum, someone open posts and someone make replies. So I will keep opening posts, which will be displayed in the listView, and if someone click into this item and make a reply, this reply will only appear in this item, not the others
I have my custom adapter to display the data, and the data are retrieved from php files and JSONObject. All the thing works fine but displaying the data correctly.
Any help would be very much appreciated.
custom adapter:
        View itemView = convertView;
        if (itemView == null) {
            itemView = getLayoutInflater().inflate(R.layout.layout_reply, parent, false);
        }

        // find the activity to work with
        ReplyItemList currentActivity = itemList.get(position);

        // fill the view
        TextView makeReplyUser = (TextView) itemView.findViewById(R.id.tvRespondent);
        makeReplyUser.setText("Re: " + currentActivity.getRespondent() + " ");
        TextView makeReplyContent = (TextView) itemView.findViewById(R.id.tvReplyContent);
        makeReplyContent.setText(currentActivity.getReplyContent());
        TextView makeReplyDatetime = (TextView) itemView.findViewById(R.id.tvReplyDatetime);
        makeReplyDatetime.setText("(" + currentActivity.getDateTime() + ")");

        return itemView;


A: Create a class with getters and setters,add your column values inside  setters using class object,then create a arraylist xyz=new arraylist();
Then add class object which contains your db values, inside the arraylist
Then bind your listview with this arraylist by passing arraylist object inside the constructor of arrayadapter
Then inside the getview()  assign/(getters) the values to the respective views

A: Your question is not very clear but if I've understood properly, you've two options; one is better than the other:
THE WORSE
You modify your getCount, getItem, getView etc... with some if conditions (if topic_nr = 36 then do not display).
THE BEST
The previous solution has a real problem: you loose a layer of abstraction.
If I had to do it, I wouldn't modify the adapter at all (because an adapter is, by design, only to render the data, not for computing them) and I would process all the operations on the list itself: concretely, I would have two lists, the data and the displayed and I would pick some items from the data and put them in the displayed and then call adapter.notifyDataSetChanged. The adapter will only show the items contained in displayed.

A: Run the query in PHP gathering the values into an array. In a loop, write out to an XML file. Call that .php URL (I know XCode for iPhones - the API is NSURL) - there should be a parser available for Android (I know there is one for iOS); so again, in a loop, create the items to make up the listview and display.
