现在,在我的 Android 应用程序中,“创建”日期采用以下格式:2014-02-21 00:00:00
我希望它采用这种格式:2014 年 2 月 21 日 00:00:00
如果可以用这段代码重新格式化它,有人可以告诉我怎么做吗?
@Override
protected void onPostExecute(String sJson) {
if(sJson == null) {
if(listener != null) listener.onFetchFailure(msg);
return;
}
try {
// convert json string to json array
JSONArray aJson = new JSONArray(sJson);
// create apps list
List<Application> apps = new ArrayList<Application>();
for(int i=0; i<aJson.length(); i++) {
JSONObject json = aJson.getJSONObject(i);
Application app = new Application();
app.setTitle(json.getString("app_title"));
app.setDesc(json.getString("description"));
app.setCreator(json.getString("creator"));
app.setCreated(json.getString("created"));
app.setRank(json.getString("rating"));
app.setIcon(json.getString("icon"));
// add the app to apps list
apps.add(app);
}
//notify the activity that fetch data has been complete
if(listener != null) listener.onFetchComplete(apps);
} catch (JSONException e) {
msg = "Invalid response";
if(listener != null) listener.onFetchFailure(msg);
return;
}
}