我正在做一个小项目,前端使用android,后端使用laravel。我有一个listview
链接到mysql数据库。最初,一切正常。但是,当我更改为新的URL时,无论做什么都不会显示任何内容,也不会显示错误。我怎样才能解决这个问题?这是我的代码:
public GetHttpResponse(Context context)
{
this.context = context;
}
@Override
protected void onPreExecute()
{
super.onPreExecute();
}
@Override
protected ArrayList<subjects> doInBackground(String... arg0)
{
HttpServicesClass httpServiceObject = new
HttpServicesClass(arg0[0]);
ArrayList<subjects> subjectsList = new ArrayList<subjects>();
try
{
httpServiceObject.ExecutePostRequest();
if(httpServiceObject.getResponseCode() == 200)
{
ResultHolder = httpServiceObject.getResponse();
if(ResultHolder != null)
{
JSONArray jsonArray = null;
try {
jsonArray = new JSONArray(ResultHolder);
JSONObject jsonObject;
subjects subjects;
for(int i=0; i<jsonArray.length(); i++)
{
subjects = new subjects();
jsonObject = jsonArray.getJSONObject(i);
if(valueInteger ==
jsonObject.getInt("tache_id") )
{
subjects.avis =
jsonObject.getDouble("avg_avis_intervention");
subjects.nom=jsonObject.getString("nom");
subjects.SubjectName =
jsonObject.getDouble("tarif");
// subjects.technicien_id =
jsonObject.getString("technicien_id");
subjectsList.add(subjects);
}}}
catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
catch (Exception e)
{
}
return subjectsList;
}
和我的新JSON输出
[
{
"nom": "teck",
"tache_id": 2,
"tarif": 100,
"avg_avis_interventions": null
}
]