Java 使用截取时出错:RecyclerView:未连接适配器;跳过布局
我尝试使用Volley在回收器视图中获取JSON数据,但我总是有这样的错误:RecyclerView:没有连接适配器;跳过布局 我收到了第一个日志错误,但没有收到第二个日志错误,因此我猜错误在json请求中Java 使用截取时出错:RecyclerView:未连接适配器;跳过布局,java,android,json,android-volley,picasso,Java,Android,Json,Android Volley,Picasso,我尝试使用Volley在回收器视图中获取JSON数据,但我总是有这样的错误:RecyclerView:没有连接适配器;跳过布局 我收到了第一个日志错误,但没有收到第二个日志错误,因此我猜错误在json请求中 private void parseJSON() { String url = "http://api.themoviedb.org/3/movie/popular?api_key=my-api-key"; Log.e("error", "and error");
private void parseJSON() {
String url = "http://api.themoviedb.org/3/movie/popular?api_key=my-api-key";
Log.e("error", "and error");
JsonObjectRequest request = new JsonObjectRequest(Request.Method.GET, url, null,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
try {
Log.e("error", "and error");
JSONArray jsonArray = response.getJSONArray("results");
for(int i = 0; i < jsonArray.length(); i++){
JSONObject result = jsonArray.getJSONObject(i);
String imageUrl = "http://image.tmdb.org/t/p/w185" + result.getString("poster_path");
mMovieList.add(new Movie(imageUrl));
}
mMovieAdapter = new MovieAdapter(MainActivity.this, mMovieList);
mRecyclerView.setAdapter(mMovieAdapter);
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
error.printStackTrace();
}
});
mRequestQueue.add(request);
}
private void parseJSON(){
字符串url=”http://api.themoviedb.org/3/movie/popular?api_key=my-api密钥”;
Log.e(“错误”、“和错误”);
JsonObjectRequest=新的JsonObjectRequest(request.Method.GET,url,null,
新的Response.Listener(){
@凌驾
公共void onResponse(JSONObject响应){
试一试{
Log.e(“错误”、“和错误”);
JSONArray JSONArray=response.getJSONArray(“结果”);
for(int i=0;i