我想在recyclerview中显示数据.onResponse方法没有被调用的问题。只是跳过并阅读下一行,为什么?。希望你们能帮助我解决这个问题。
logcat的
09-21 07:01:21.209 25837-25837/com.example.user.mycustomvolley E/RecyclerView: No adapter attached; skipping layout
09-21 07:01:21.481 25837-25928/com.example.user.mycustomvolley D/gralloc_ranchu: Emulator without host-side GPU emulation detected.
09-21 07:01:23.512 25837-25837/com.example.user.mycustomvolley W/System.err: com.android.volley.TimeoutError
09-21 07:01:23.512 25837-25837/com.example.user.mycustomvolley W/System.err: at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:147)
09-21 07:01:23.512 25837-25837/com.example.user.mycustomvolley W/System.err: at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:114)
09-21 07:01:23.626 25837-25928/com.example.user.mycustomvolley V/RenderScript: 0xa0682000 Launching thread(s), CPUs 2
09-21 07:01:27.014 25837-25928/com.example.user.mycustomvolley E/Surface: getSlotFromBufferLocked: unknown buffer: 0xa1272470
09-21 07:03:35.708 27721-27727/com.example.user.mycustomvolley I/art: Debugger is active
09-21 07:03:35.886 27721-27721/com.example.user.mycustomvolley I/System.out: Debugger has connected
09-21 07:03:35.886 27721-27721/com.example.user.mycustomvolley I/System.out: waiting for debugger to settle...
09-21 07:03:36.088 27721-27721/com.example.user.mycustomvolley I/System.out: waiting for debugger to settle...
09-21 07:03:36.292 27721-27721/com.example.user.mycustomvolley I/System.out: waiting for debugger to settle...
09-21 07:03:36.506 27721-27721/com.example.user.mycustomvolley I/System.out: waiting for debugger to settle...
09-21 07:03:36.711 27721-27721/com.example.user.mycustomvolley I/System.out: waiting for debugger to settle...
09-21 07:03:36.914 27721-27721/com.example.user.mycustomvolley I/System.out: waiting for debugger to settle...
09-21 07:03:37.116 27721-27721/com.example.user.mycustomvolley I/System.out: debugger has settled (1323)
09-21 07:03:37.124 27721-27721/com.example.user.mycustomvolley W/System: ClassLoader referenced unknown path: /data/app/com.example.user.mycustomvolley-1/lib/x86
09-21 07:03:38.937 27721-27721/com.example.user.mycustomvolley W/System: ClassLoader referenced unknown path: /data/app/com.example.user.mycustomvolley-1/lib/x86
09-21 07:03:39.088 27721-27721/com.example.user.mycustomvolley W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
09-21 07:03:39.342 27721-27803/com.example.user.mycustomvolley D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
09-21 07:03:39.386 27721-27803/com.example.user.mycustomvolley I/OpenGLRenderer: Initialized EGL, version 1.4
09-21 07:03:39.392 27721-27721/com.example.user.mycustomvolley E/RecyclerView: No adapter attached; skipping layout
09-21 07:03:39.438 27721-27721/com.example.user.mycustomvolley E/RecyclerView: No adapter attached; skipping layout
09-21 07:03:39.638 27721-27803/com.example.user.mycustomvolley D/gralloc_ranchu: Emulator without host-side GPU emulation detected.
09-21 07:03:42.079 27721-27727/com.example.user.mycustomvolley W/art: Suspending all threads took: 7.780ms
09-21 07:04:17.707 27721-27721/com.example.user.mycustomvolley W/System.err: com.android.volley.TimeoutError
09-21 07:04:17.707 27721-27721/com.example.user.mycustomvolley W/System.err: at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:147)
09-21 07:04:17.707 27721-27721/com.example.user.mycustomvolley W/System.err: at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:114)
09-21 07:04:17.832 27721-27803/com.example.user.mycustomvolley V/RenderScript: 0xa084c000 Launching thread(s), CPUs 2
09-21 07:04:19.007 27721-27803/com.example.user.mycustomvolley E/Surface: getSlotFromBufferLocked: unknown buffer: 0xa0cfded0
09-21 07:04:30.487 28470-28470/com.example.user.mycustomvolley W/ActivityThread: Application com.example.user.mycustomvolley is waiting for the debugger on port 8100...
09-21 07:04:30.489 28470-28470/com.example.user.mycustomvolley I/System.out: Sending WAIT chunk
09-21 07:04:30.707 28470-28476/com.example.user.mycustomvolley I/art: Debugger is active
09-21 07:04:30.891 28470-28470/com.example.user.mycustomvolley I/System.out: Debugger has connected
09-21 07:04:30.891 28470-28470/com.example.user.mycustomvolley I/System.out: waiting for debugger to settle...
09-21 07:04:31.093 28470-28470/com.example.user.mycustomvolley I/System.out: waiting for debugger to settle...
09-21 07:04:31.294 28470-28470/com.example.user.mycustomvolley I/System.out: waiting for debugger to settle...
09-21 07:04:31.495 28470-28470/com.example.user.mycustomvolley I/System.out: waiting for debugger to settle...
09-21 07:04:31.695 28470-28470/com.example.user.mycustomvolley I/System.out: waiting for debugger to settle...
09-21 07:04:31.897 28470-28470/com.example.user.mycustomvolley I/System.out: waiting for debugger to settle...
09-21 07:04:32.099 28470-28470/com.example.user.mycustomvolley I/System.out: waiting for debugger to settle...
09-21 07:04:32.305 28470-28470/com.example.user.mycustomvolley I/System.out: debugger has settled (1408)
09-21 07:04:32.317 28470-28470/com.example.user.mycustomvolley W/System: ClassLoader referenced unknown path: /data/app/com.example.user.mycustomvolley-1/lib/x86
09-21 07:04:34.794 28470-28470/com.example.user.mycustomvolley W/System: ClassLoader referenced unknown path: /data/app/com.example.user.mycustomvolley-1/lib/x86
09-21 07:04:34.917 28470-28470/com.example.user.mycustomvolley W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
09-21 07:04:35.153 28470-28470/com.example.user.mycustomvolley W/art: Verification of void com.example.user.mycustomvolley.BackgroundTask.setOnCallBack(com.example.user.mycustomvolley.BackgroundTask$CallBack) took 123.946ms
09-21 07:04:35.187 28470-28565/com.example.user.mycustomvolley D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
09-21 07:04:35.219 28470-28565/com.example.user.mycustomvolley I/OpenGLRenderer: Initialized EGL, version 1.4
09-21 07:04:35.226 28470-28470/com.example.user.mycustomvolley E/RecyclerView: No adapter attached; skipping layout
09-21 07:04:35.260 28470-28470/com.example.user.mycustomvolley E/RecyclerView: No adapter attached; skipping layout
09-21 07:04:35.460 28470-28565/com.example.user.mycustomvolley D/gralloc_ranchu: Emulator without host-side GPU emulation detected.
09-21 07:04:55.574 28470-28476/com.example.user.mycustomvolley W/art: Suspending all threads took: 13.404ms
09-21 07:06:27.320 28470-28476/com.example.user.mycustomvolley W/art: Debugger attempted to resume all threads without having suspended them all before.
09-21 07:06:27.323 28470-28470/com.example.user.mycustomvolley W/System.err: com.android.volley.TimeoutError
09-21 07:06:27.323 28470-28470/com.example.user.mycustomvolley W/System.err: at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:147)
09-21 07:06:27.323 28470-28470/com.example.user.mycustomvolley W/System.err: at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:114)
09-21 07:06:41.930 30179-30179/com.example.user.mycustomvolley W/ActivityThread: Application com.example.user.mycustomvolley is waiting for the debugger on port 8100...
09-21 07:06:41.952 30179-30179/com.example.user.mycustomvolley I/System.out: Sending WAIT chunk
09-21 07:06:42.107 30179-30185/com.example.user.mycustomvolley I/art: Debugger is active
09-21 07:06:42.153 30179-30179/com.example.user.mycustomvolley I/System.out: Debugger has connected
09-21 07:06:42.153 30179-30179/com.example.user.mycustomvolley I/System.out: waiting for debugger to settle...
09-21 07:06:42.353 30179-30179/com.example.user.mycustomvolley I/System.out: waiting for debugger to settle...
09-21 07:06:42.553 30179-30179/com.example.user.mycustomvolley I/System.out: waiting for debugger to settle...
09-21 07:06:42.755 30179-30179/com.example.user.mycustomvolley I/System.out: waiting for debugger to settle...
09-21 07:06:42.965 30179-30179/com.example.user.mycustomvolley I/System.out: waiting for debugger to settle...
09-21 07:06:43.166 30179-30179/com.example.user.mycustomvolley I/System.out: waiting for debugger to settle...
09-21 07:06:43.369 30179-30179/com.example.user.mycustomvolley I/System.out: waiting for debugger to settle...
09-21 07:06:43.571 30179-30179/com.example.user.mycustomvolley I/System.out: debugger has settled (1342)
09-21 07:06:43.584 30179-30179/com.example.user.mycustomvolley W/System: ClassLoader referenced unknown path: /data/app/com.example.user.mycustomvolley-1/lib/x86
09-21 07:06:45.336 30179-30179/com.example.user.mycustomvolley W/System: ClassLoader referenced unknown path: /data/app/com.example.user.mycustomvolley-1/lib/x86
09-21 07:06:45.464 30179-30179/com.example.user.mycustomvolley W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
09-21 07:06:45.696 30179-30260/com.example.user.mycustomvolley D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
09-21 07:06:45.751 30179-30260/com.example.user.mycustomvolley I/OpenGLRenderer: Initialized EGL, version 1.4
09-21 07:06:45.764 30179-30179/com.example.user.mycustomvolley E/RecyclerView: No adapter attached; skipping layout
09-21 07:06:45.816 30179-30179/com.example.user.mycustomvolley E/RecyclerView: No adapter attached; skipping layout
09-21 07:06:46.013 30179-30260/com.example.user.mycustomvolley D/gralloc_ranchu: Emulator without host-side GPU emulation detected.
09-21 07:06:48.244 30179-30179/com.example.user.mycustomvolley W/System.err: com.android.volley.TimeoutError
09-21 07:06:48.244 30179-30179/com.example.user.mycustomvolley W/System.err: at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:147)
09-21 07:06:48.244 30179-30179/com.example.user.mycustomvolley W/System.err: at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:114)
09-21 07:06:48.347 30179-30260/com.example.user.mycustomvolley V/RenderScript: 0xa083e000 Launching thread(s), CPUs 2
09-21 07:06:51.745 30179-30260/com.example.user.mycustomvolley E/Surface: getSlotFromBufferLocked: unknown buffer: 0xa0852850
09-21 07:07:14.345 30626-30626/com.example.user.mycustomvolley W/System: ClassLoader referenced unknown path: /data/app/com.example.user.mycustomvolley-1/lib/x86
09-21 07:07:17.156 30626-30626/com.example.user.mycustomvolley W/System: ClassLoader referenced unknown path: /data/app/com.example.user.mycustomvolley-1/lib/x86
09-21 07:07:17.250 30626-30626/com.example.user.mycustomvolley W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
09-21 07:07:17.388 30626-30700/com.example.user.mycustomvolley D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
09-21 07:07:17.422 30626-30700/com.example.user.mycustomvolley I/OpenGLRenderer: Initialized EGL, version 1.4
09-21 07:07:17.425 30626-30626/com.example.user.mycustomvolley E/RecyclerView: No adapter attached; skipping layout
09-21 07:07:17.445 30626-30626/com.example.user.mycustomvolley E/RecyclerView: No adapter attached; skipping layout
09-21 07:07:17.677 30626-30700/com.example.user.mycustomvolley D/gralloc_ranchu: Emulator without host-side GPU emulation detected.
09-21 07:07:19.939 30626-30626/com.example.user.mycustomvolley W/System.err: com.android.volley.TimeoutError
09-21 07:07:19.940 30626-30626/com.example.user.mycustomvolley W/System.err: at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:147)
09-21 07:07:19.940 30626-30626/com.example.user.mycustomvolley W/System.err: at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:114)
09-21 07:07:20.135 30626-30700/com.example.user.mycustomvolley V/RenderScript: 0xa0746000 Launching thread(s), CPUs 2
09-21 07:07:23.445 30626-30700/com.example.user.mycustomvolley E/Surface: getSlotFromBufferLocked: unknown buffer: 0xa05b8850
09-21 07:07:36.733 30939-30939/com.example.user.mycustomvolley W/System: ClassLoader referenced unknown path: /data/app/com.example.user.mycustomvolley-1/lib/x86
09-21 07:07:36.837 30939-30939/com.example.user.mycustomvolley W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
09-21 07:07:36.955 30939-30998/com.example.user.mycustomvolley D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
09-21 07:07:36.988 30939-30998/com.example.user.mycustomvolley I/OpenGLRenderer: Initialized EGL, version 1.4
09-21 07:07:36.991 30939-30939/com.example.user.mycustomvolley E/RecyclerView: No adapter attached; skipping layout
09-21 07:07:37.014 30939-30939/com.example.user.mycustomvolley E/RecyclerView: No adapter attached; skipping layout
09-21 07:07:37.211 30939-30998/com.example.user.mycustomvolley D/gralloc_ranchu: Emulator without host-side GPU emulation detected.
09-21 07:07:39.506 30939-30939/com.example.user.mycustomvolley W/System.err: com.android.volley.TimeoutError
09-21 07:07:39.506 30939-30939/com.example.user.mycustomvolley W/System.err: at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:147)
09-21 07:07:39.506 30939-30939/com.example.user.mycustomvolley W/System.err: at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:114)
09-21 07:07:39.675 30939-30998/com.example.user.mycustomvolley V/RenderScript: 0xa0848000 Launching thread(s), CPUs 2
09-21 07:07:43.022 30939-30998/com.example.user.mycustomvolley E/Surface: getSlotFromBufferLocked: unknown buffer: 0xa08b7580
09-21 07:08:23.919 31595-31595/com.example.user.mycustomvolley W/System: ClassLoader referenced unknown path: /data/app/com.example.user.mycustomvolley-1/lib/x86
09-21 07:08:24.056 31595-31595/com.example.user.mycustomvolley W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
09-21 07:08:24.192 31595-31635/com.example.user.mycustomvolley D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
09-21 07:08:24.237 31595-31635/com.example.user.mycustomvolley I/OpenGLRenderer: Initialized EGL, version 1.4
09-21 07:08:24.244 31595-31595/com.example.user.mycustomvolley E/RecyclerView: No adapter attached; skipping layout
09-21 07:08:24.272 31595-31595/com.example.user.mycustomvolley E/RecyclerView: No adapter attached; skipping layout
09-21 07:08:24.482 31595-31635/com.example.user.mycustomvolley D/gralloc_ranchu: Emulator without host-side GPU emulation detected.
09-21 07:08:26.726 31595-31595/com.example.user.mycustomvolley W/System.err: com.android.volley.TimeoutError
09-21 07:08:26.726 31595-31595/com.example.user.mycustomvolley W/System.err: at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:147)
09-21 07:08:26.726 31595-31595/com.example.user.mycustomvolley W/System.err: at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:114)
09-21 07:08:26.910 31595-31635/com.example.user.mycustomvolley V/RenderScript: 0xa0855000 Launching thread(s), CPUs 2
09-21 07:08:30.241 31595-31635/com.example.user.mycustomvolley E/Surface: getSlotFromBufferLocked: unknown buffer: 0xa0cc74f0
09-21 07:09:14.253 32308-32308/com.example.user.mycustomvolley W/System: ClassLoader referenced unknown path: /data/app/com.example.user.mycustomvolley-1/lib/x86
09-21 07:09:15.592 32308-32308/com.example.user.mycustomvolley W/System: ClassLoader referenced unknown path: /data/app/com.example.user.mycustomvolley-1/lib/x86
09-21 07:09:15.706 32308-32308/com.example.user.mycustomvolley W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
09-21 07:09:15.835 32308-32358/com.example.user.mycustomvolley D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
09-21 07:09:15.870 32308-32358/com.example.user.mycustomvolley I/OpenGLRenderer: Initialized EGL, version 1.4
09-21 07:09:15.876 32308-32308/com.example.user.mycustomvolley E/RecyclerView: No adapter attached; skipping layout
09-21 07:09:15.896 32308-32308/com.example.user.mycustomvolley E/RecyclerView: No adapter attached; skipping layout
09-21 07:09:16.108 32308-32358/com.example.user.mycustomvolley D/gralloc_ranchu: Emulator without host-side GPU emulation detected.
09-21 07:09:18.372 32308-32308/com.example.user.mycustomvolley W/System.err: com.android.volley.TimeoutError
09-21 07:09:18.372 32308-32308/com.example.user.mycustomvolley W/System.err: at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:147)
09-21 07:09:18.372 32308-32308/com.example.user.mycustomvolley W/System.err: at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:114)
09-21 07:09:18.508 32308-32358/com.example.user.mycustomvolley V/RenderScript: 0xa0847000 Launching thread(s), CPUs 2
09-21 07:09:21.877 32308-32358/com.example.user.mycustomvolley E/Surface: getSlotFromBufferLocked: unknown buffer: 0xa19aaff0
09-21 07:10:40.450 32308-32314/com.example.user.mycustomvolley W/art: Suspending all threads took: 12.822ms
09-21 07:12:12.869 2811-2811/com.example.user.mycustomvolley W/ActivityThread: Application com.example.user.mycustomvolley is waiting for the debugger on port 8100...
09-21 07:12:12.876 2811-2811/com.example.user.mycustomvolley I/System.out: Sending WAIT chunk
09-21 07:12:13.053 2811-2817/com.example.user.mycustomvolley I/art: Debugger is active
09-21 07:12:13.080 2811-2811/com.example.user.mycustomvolley I/System.out: Debugger has connected
09-21 07:12:13.080 2811-2811/com.example.user.mycustomvolley I/System.out: waiting for debugger to settle...
09-21 07:12:13.281 2811-2811/com.example.user.mycustomvolley I/System.out: waiting for debugger to settle...
09-21 07:12:13.481 2811-2811/com.example.user.mycustomvolley I/System.out: waiting for debugger to settle...
09-21 07:12:13.682 2811-2811/com.example.user.mycustomvolley I/System.out: waiting for debugger to settle...
09-21 07:12:13.892 2811-2811/com.example.user.mycustomvolley I/System.out: waiting for debugger to settle...
09-21 07:12:14.093 2811-2811/com.example.user.mycustomvolley I/System.out: waiting for debugger to settle...
09-21 07:12:14.294 2811-2811/com.example.user.mycustomvolley I/System.out: waiting for debugger to settle...
09-21 07:12:14.496 2811-2811/com.example.user.mycustomvolley I/System.out: debugger has settled (1302)
09-21 07:12:14.502 2811-2811/com.example.user.mycustomvolley W/System: ClassLoader referenced unknown path: /data/app/com.example.user.mycustomvolley-1/lib/x86
09-21 07:12:16.054 2811-2811/com.example.user.mycustomvolley W/System: ClassLoader referenced unknown path: /data/app/com.example.user.mycustomvolley-1/lib/x86
09-21 07:12:16.315 2811-2811/com.example.user.mycustomvolley W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
09-21 07:22:04.091 10870-10870/com.example.user.mycustomvolley W/System: ClassLoader referenced unknown path: /data/app/com.example.user.mycustomvolley-1/lib/x86
09-21 07:22:04.193 10870-10870/com.example.user.mycustomvolley W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
09-21 07:22:04.312 10870-10917/com.example.user.mycustomvolley D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
09-21 07:22:04.353 10870-10917/com.example.user.mycustomvolley I/OpenGLRenderer: Initialized EGL, version 1.4
09-21 07:22:04.360 10870-10870/com.example.user.mycustomvolley E/RecyclerView: No adapter attached; skipping layout
09-21 07:22:04.386 10870-10870/com.example.user.mycustomvolley E/RecyclerView: No adapter attached; skipping layout
09-21 07:22:04.592 10870-10917/com.example.user.mycustomvolley D/gralloc_ranchu: Emulator without host-side GPU emulation detected.
09-21 07:22:06.848 10870-10870/com.example.user.mycustomvolley W/System.err: com.android.volley.TimeoutError
09-21 07:22:06.848 10870-10870/com.example.user.mycustomvolley W/System.err: at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:147)
09-21 07:22:06.848 10870-10870/com.example.user.mycustomvolley W/System.err: at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:114)
09-21 07:22:06.988 10870-10917/com.example.user.mycustomvolley V/RenderScript: 0xa0c18000 Launching thread(s), CPUs 2
09-21 07:22:10.354 10870-10917/com.example.user.mycustomvolley E/Surface: getSlotFromBufferLocked: unknown buffer: 0xa0c4afb0
09-21 07:22:46.875 11460-11460/com.example.user.mycustomvolley W/System: ClassLoader referenced unknown path: /data/app/com.example.user.mycustomvolley-1/lib/x86
09-21 07:22:47.044 11460-11460/com.example.user.mycustomvolley W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
09-21 07:22:47.173 11460-11518/com.example.user.mycustomvolley D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
09-21 07:22:47.218 11460-11518/com.example.user.mycustomvolley I/OpenGLRenderer: Initialized EGL, version 1.4
09-21 07:22:47.233 11460-11460/com.example.user.mycustomvolley E/RecyclerView: No adapter attached; skipping layout
09-21 07:22:47.278 11460-11460/com.example.user.mycustomvolley E/RecyclerView: No adapter attached; skipping layout
09-21 07:22:47.483 11460-11518/com.example.user.mycustomvolley D/gralloc_ranchu: Emulator without host-side GPU emulation detected.
09-21 07:22:49.725 11460-11460/com.example.user.mycustomvolley W/System.err: com.android.volley.TimeoutError
09-21 07:22:49.725 11460-11460/com.example.user.mycustomvolley W/System.err: at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:147)
09-21 07:22:49.725 11460-11460/com.example.user.mycustomvolley W/System.err: at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:114)
09-21 07:22:49.866 11460-11518/com.example.user.mycustomvolley V/RenderScript: 0xa077e000 Launching thread(s), CPUs 2
09-21 07:22:53.233 11460-11518/com.example.user.mycustomvolley E/Surface: getSlotFromBufferLocked: unknown buffer: 0xa0bd5fe0
MainActivity.java
package com.example.user.mycustomvolley;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity {
RecyclerView recyclerView;
RecyclerView.Adapter adapter;
RecyclerView.LayoutManager layoutManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
recyclerView = (RecyclerView) findViewById(R.id.recyclerview);
recyclerView.setHasFixedSize(true);
layoutManager = new LinearLayoutManager(this);
recyclerView.setLayoutManager(layoutManager);
BackgroundTask backgroundTask = new BackgroundTask(MainActivity.this);
backgroundTask.setOnCallBack(new BackgroundTask.CallBack() {
@Override
public void onSuccess(ArrayList<ArtInformation> artInformations) {
adapter = new RecyclerAdapter(artInformations,MainActivity.this);
recyclerView.setAdapter(adapter);
}
@Override
public void onfailed(String msg) {
}
});
}
}
Background.Task.java
package com.example.user.mycustomvolley;
import android.app.ProgressDialog;
import android.content.Context;
import android.telecom.Call;
import android.util.Log;
import android.widget.Toast;
import com.android.volley.DefaultRetryPolicy;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.RetryPolicy;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonArrayRequest;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
/**
* Created by User on 9/17/2016.
*/
public class BackgroundTask {
Context context;
ArrayList<ArtInformation> arrayList = new ArrayList<>();
private static final String json_url = "http://192.168.1.7/volley/imagetext/getData.php";
public BackgroundTask(Context context){
this.context = context;
}
public void setOnCallBack(final CallBack onCallBack){
//make json request.
JsonArrayRequest jsonArrayRequest = new JsonArrayRequest(Request.Method.POST,json_url,(String) null, new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
int count = 0;
while (count < response.length()) {
try {
JSONObject jsonObject = response.getJSONObject(count);
ArtInformation artInformation = new ArtInformation(jsonObject.getString("art"),jsonObject.getString("image"));
arrayList.add(artInformation);
count++;
} catch (JSONException ex) {
ex.printStackTrace();
}
}
onCallBack.onSuccess(arrayList);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(context,"Error:[JSON Process",Toast.LENGTH_LONG).show();
//progressDialog.hide();
Log.d("Check:","-->"+error.getMessage());
}
});
MySingleton.getmInstances(context).addToRequestQueue(jsonArrayRequest);
}
public interface CallBack{
void onSuccess(ArrayList<ArtInformation> artInformations);
void onfailed(String msg);
}
}
答案 0 :(得分:2)
Volley正在向您的服务器发送请求但由于某种原因没有连接,并且发生了超时。你可以看到以下行是你的logcat
09-21 07:22:06.848 10870-10870/com.example.user.mycustomvolley W/System.err: com.android.volley.TimeoutError
09-21 07:22:06.848 10870-10870/com.example.user.mycustomvolley W/System.err: at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:147)
09-21 07:22:06.848 10870-10870/com.example.user.mycustomvolley W/System.err: at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:114).
请尝试以下