我使用在laravel中创建的api作为url使用android 2.3.3中的xampp服务器从数据库中获取数据。
使用相同的wifi源。检查internet权限检查代码
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文本视图中的id值、标题textview中的标题值和正文文本视图中的body值。
实际结果:我得到了jsonexception;id没有值
发布于 2019-04-12 17:41:10
下面的图片介绍了您的数据结构。您的错误是,您试图访问数组中的数据,而不访问数组中的元素。

https://stackoverflow.com/questions/55637414
复制相似问题