无法从内存中释放Exoplayer

时间:2016-08-09 11:50:12

标签: android-activity android-recyclerview exoplayer

我在Exoplayer中使用Recyclerivew。我想释放Exoplayer Activity上的ViewHolder。我在Exoplayer中使用Exoplayer。我无法找到释放 public void releaseMemory() { audioCapabilitiesReceiver.unregister();//Method in the ViewHolder player.release(); } public void releaseMemory() { viewHolder.releaseMemory();//Method in the Adapter } @Override protected void onDestroy() { videoAdapter.releaseMemory();//Method in the Activity super.onDestroy(); } 的任何方法。

RuntimeException

现在我得到了E/AndroidRuntime: FATAL EXCEPTION: main Process: com.waynell.videolist.demo, PID: 22746 java.lang.RuntimeException: Unable to stop activity {com.waynell.videolist.demo/com.waynell.videolist.demo.activity.MainActivity}: java.lang.NullPointerException at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3487) at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3541) at android.app.ActivityThread.access$1400(ActivityThread.java:138) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1289) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:149) at android.app.ActivityThread.main(ActivityThread.java:5045) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:610) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NullPointerException at com.waynell.videolist.demo.activity.MainActivity.onStop(MainActivity.java:325) at android.app.Instrumentation.callActivityOnStop(Instrumentation.java:1212) at android.app.Activity.performStop(Activity.java:5376) at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3482) at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3541)  at android.app.ActivityThread.access$1400(ActivityThread.java:138)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1289)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:149)  at android.app.ActivityThread.main(ActivityThread.java:5045)  at java.lang.reflect.Method.invokeNative(Native Method)  at java.lang.reflect.Method.invoke(Method.java:515)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:610)  at dalvik.system.NativeStart.main(Native Method)  。还有其他有效的方法吗。

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAJOjAACTowHRsvDGAAAAB3RJTUUH4AUXFRkcSlLFuAAAA8BJREFUeNrt2sFx6kAQRVGGEMhB6UywpEMOk4JIQBshgeh556x+1d+4pO7rxnZb1/VWweP1rPGFsstYevMUrtOqBEAMRAEBEAIxQACEQAwQACEQAwRACIQAARACIUAAREAIEAAhEAIEQAhEAAEQASFgw91AIPguAIOB+AuAECACPgIYCATfBWAwEH8XgGFA9AVABBABARABREAAQAQEwBWACAiACCACAiACiIAAAALgCsAVIAAigAgIAIiAALgCQADAFSAArgBEQAAAAXAF4AoQAEAAXAG4AgQAREAAXAEgAIAAgI8BAgAIgJ8D4AoQAEAAwBUgAD4GgAAAAgA+BggAIAB+DgACAOkfAwQAXACAAAACAGT8HEAATuQ3AbgAAAEABAAQAEAAAAGAmVX6VaAAgAsAEABAAAAB4AP+HBgBAAQAEABAAAABAAQAEABAAAABAAQAEABAAAABAAQAEABAAAABAAQAEABAAAABAAQAEABAAAABAAEABAAQAEAAAAEABAAQAEAAAAEABAAQAEAAAAEABAAQAEAAAAEABAAQAEAAAAEABAAQAEAAAAEABAAQAEAAAAEABAAQAEAAAAEABAAQAEAAAAEAAQAEABAAQAAAAQAEABAAQAAAAQAEABAAQAAAAQAEABAAQAAAAQAEABAAQAAAAQAEABAAQAAAAQAEABAAQAAAAQAEABAAQAAAAQAEABAAQAAAAQABAAQAEABAAAABAAQAEABAAAABAAQAEABAAAABAAQAEABAAAABAAQAEABAAAABAAQAEABAAAABAAQAEABAAAABAAQAEABAAAABAAQAEABAAAABAAEABACOGktvY+nNkxAAApd/698IAEHL7xoQAMKXf8//IwBMuvwiIACEL78ICADhyy8CAsAki390iUVAAAj6ri8CAoDl/8o1gQBQcPldAwKA5RcBASB9+UVAAAhffhEQAP5k8a9eQhEQAMIXTwQEgPCF82tCAcB3W9eAAJC+XCIgAIQvlQgIAOHLJAICwMEFqr5EIiAAhC+OCAgA4QsjAgJA+KL4WwEBwHdJ14AAkL4UIiAAhC+DCAiA5Q9fAhEQgNjBN/wiIAAGHs9EAAw6riIBsPx4TgJgqD0vz0sADLPnhgAYYs8PASg3uIZXBATAwOKZCoBBxVUlAJYfz1kADCWetwAYRjx3ATCEeP4CUG7wLL8ICICBwzsRAIOGq0wALD/ekwAYKrwvATBMeG8CYIjw/gSg3OBYfhEQAAODdyoABgVXnQBYfrxnATAUeN+/9gZBC2sqNVymHwAAAABJRU5ErkJggg==

1 个答案:

答案 0 :(得分:0)

你可以停止玩家onStop()方法来代替onOtroy();