【发布时间】:2019-07-19 00:19:39
【问题描述】:
我想从 mysql 服务器获取图像到回收站视图。当我运行我的应用程序时。我面临以下问题:
02-25 19:47:47.075 653-12579/? E/WakeLock:GCM_HB_ALARM 释放 没有匹配的获取! 02-25 19:47:53.241 69-403/?电子/快线: 没有收到预期的优先级提升 02-25 19:47:53.393 14523-14523/com.example.wiqarali.tourismapp E/RecyclerView:无适配器 随附的;跳过布局 02-25 19:47:53.466 14523-14523/com.example.wiqarali.tourismapp E/EventBus:不能 调度事件:类 com.example.wiqarali.tourismapp.serverclasses.GalleryEventBus 到 订阅类 com.example.wiqarali.tourismapp.GalleryActivity java.lang.NullPointerException:尝试调用虚拟方法'void android.support.v7.widget.RecyclerView.setLayoutManager(android.support.v7.widget.RecyclerView$LayoutManager)' 在空对象引用上 在 com.example.wiqarali.tourismapp.GalleryActivity.onMessageEvent(GalleryActivity.java:131) 在 java.lang.reflect.Method.invoke(本机方法) 在 java.lang.reflect.Method.invoke(Method.java:372) 在 org.greenrobot.eventbus.EventBus.invokeSubscriber(EventBus.java:507) 在 org.greenrobot.eventbus.EventBus.postToSubscription(EventBus.java:434) 在 org.greenrobot.eventbus.EventBus.postSingleEventForEventType(EventBus.java:411) 在 org.greenrobot.eventbus.EventBus.postSingleEvent(EventBus.java:384) 在 org.greenrobot.eventbus.EventBus.post(EventBus.java:265) 在 com.example.wiqarali.tourismapp.serverclasses.GetImages$1.onResponse(GetImages.java:59) 在 com.example.wiqarali.tourismapp.serverclasses.GetImages$1.onResponse(GetImages.java:37) 在 com.android.volley.toolbox.StringRequest.deliverResponse(StringRequest.java:82) 在 com.android.volley.toolbox.StringRequest.deliverResponse(StringRequest.java:29) 在 com.android.volley.ExecutorDelivery$ResponseDeliveryRunnable.run(ExecutorDelivery.java:102) 在 android.os.Handler.handleCallback(Handler.java:739) 在 android.os.Handler.dispatchMessage(Handler.java:95) 在 android.os.Looper.loop(Looper.java:135)
这是我的事件总线代码
@Subscribe(threadMode = ThreadMode.MAIN)
public void onMessageEvent(GalleryEventBus eventBus){
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false);
recyclerView_gallery.setLayoutManager(linearLayoutManager);
recyclerView_gallery.setItemAnimator(new DefaultItemAnimator());
GalleryAdapter adapter = new GalleryAdapter(this, eventBus.galleryList);
recyclerView_gallery.setAdapter(adapter);
adapter.notifyDataSetChanged();
}
【问题讨论】:
-
我和你有同样的问题
标签: android