請幫我解析頁面!我不介意做什麼修復類型org.json.JSONArray的值無法轉換爲JSONObject
PHP代碼:
[{"DATE_REG":"04.04.2014","NAME_WDAY":"\u041f`\u044f\u0442\u043d\u0438\u0446\u044f","NAME_PAIR":"3 \u043f\u0430\u0440\u0430","TIME_PAIR":"11:25-12:45""},{"DATE_REG":"04.04.2014","NAME_WDAY":"\u041f`\u044f\u0442\u043d\u0438\u0446\u044f","NAME_PAIR":"6 \u043f\u0430\u0440\u0430","TIME_PAIR":"16:35-17:55""}]
我的代碼:
private class JSONParse extends AsyncTask<String, String, JSONObject> {
private ProgressDialog pDialog;
@Override
protected void onPreExecute() {
super.onPreExecute();
name2 = (TextView)findViewById(R.id.name);
para2 = (TextView)findViewById(R.id.para);
aud2 = (TextView)findViewById(R.id.aud);
}
@Override
protected JSONObject doInBackground(String... args) {
JSONParser jParser = new JSONParser();
JSONObject json = jParser.getJSONFromUrl(url);
return json;
}
@Override
protected void onPostExecute(JSONObject json) {
pDialog.dismiss();
try {
// Getting JSON Array
for(int i=0; i < jsonarray.length(); i++) {
JSONObject c = new JSONObject();
// Storing JSON item in a Variable
String NAME_FIO = c.getString(prepod);
String ABBR_DISC = c.getString(para);
String NAME_AUD = c.getString(audit);
//Set JSON Data in TextView
name2.setText(NAME_FIO);
para2.setText(ABBR_DISC);
aud2.setText(NAME_AUD);
}
} catch (JSONException e) {
e.printStackTrace();
}