我使用在laravel中创建的api作为url,在android studio 2.3.3中使用xampp服务器从数据库中获取数据
使用相同的wifi源。检查互联网权限检查代码
public void onResponse(JSONObject response)
{
try
{
id.setText(response.getString("id"));
title.setText(response.getString("title"));
body.setText(response.getString("body"));
}
catch (JSONException e)
{
e.printStackTrace();
}
}
预期结果:id textview的id值,title textview的title值和body textview的body值。
实际结果:我得到jsonexception
;没有id的值