How to sort JSONArray by its Tag name with ascending and descending on android.
In my application i have a JSON like the following and need to display the data according to users option(sorting by user_id tag in ascending or descending order). I have parsed the JSON as the following:
JSONObject mObject = new JSONObject(JSONResponse);
String commentsVal = mObject.getString("message");
String resultVal = mObject.getString("result");
JSONArray resultArray = new JSONArray(resultVal);
int resultSize = resultArray.length();
for (int i = 0; i < resultArray.length(); i++) {
    JSONObject resultObj = resultArray.getJSONObject(i);
    resultObj.getString("comment_id");
    .....
}
..............  
and this is my JSON response:
{
"success": 1,
"message": "some message",
"result": [
    {
        "comment_id": "43906",
        "comp_id": "116725",
        "user_id": "48322",
        "agree": "0",
        .....
        "replies": [....]
    },
    {
        "comment_id": "43905",
        "comp_id": "116725",
        "user_id": "48248",
        "agree": "0",
        .......
        "replies": [...]
    }
]
}
I need the "result" JSON Array sorted by the "user_id" tag name while parsing, how to do it in Android?

