Q:

Request for Date Display Solution

final String message[] = {"","",""};
    try{
        String UID = null, UBAL = null;
        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        Calendar PDate;

        ArrayList<NameValuePair> postParameters = new ArrayList<NameValuePair>();
        postParameters.add(new BasicNameValuePair("UserID",id.getId()));

        response = connection.executeHttpPost("http://condoproject.net16.net/PayCheck.php", postParameters);
        Toast.makeText(getApplicationContext(), ""+response, Toast.LENGTH_LONG).show();

        JSONArray jArray = new JSONArray(response);

        for(int i = 0; i<jArray.length();i++)
        {
            JSONObject json_data= (JSONObject) jArray.get(i);

            Toast.makeText(getApplicationContext(), ""+json_data, Toast.LENGTH_LONG).show();

            UID = json_data.getString("UserID");
            UBAL = json_data.getString("UPayment");

            Uid1.setText(UID);
            ubal.setText(UBAL);

            PDate = (Calendar) json_data.get("PayDate");
            PDate.add(Calendar.MONTH, 1);               

            String P = ""+PDate;
            Udate.setText(P);

        }

the UserID and the Balance are able to be display, but only for the date textview is empty. May I know the solution for this?

A:

This is probably wrong:
PDate = (Calendar) json_data.get("PayDate");
PDate.add(Calendar.MONTH, 1);  
String P = ""+PDate;

First, I doubt casting from JSONObject to Calendar works this way. "Values may be any mix of JSONObjects, other JSONArrays, Strings, Booleans, Integers, Longs, Doubles, null or NULL. Values may not be NaNs, infinities, or of any type not listed here." (here)
Try:
String myDateString = json_data.getString("PayDate"); // you can get a date as String

Second, you can't get a date in human readable format this way:
String P = ""+PDate;

If you want to add something to your date, you have to convert and convert back, for example:
// assuming that the format of your date is "yyyy-MM-dd"
//convert from String to Date
Date myDate = dateFormat.parse(myDateString);
//convert from Date to Calendar
PDate = Calendar.getInstance();
PDate.setTime(myDate);
//this adds 1 month to your Calendar object:
PDate.add(Calendar.MONTH, 1);
//this converts back from Calendar to Date object
myDate = PDate.getTime();
//this converts from Date to String
myDateString = dateFormat.format(myDate);

// and update text
Udate.setText(myDateString );

if you only add one month to PDate to compensate for the fact that it stores month values from 0 to 11, then you can just do as Dheeraj said

