Skip to content
Advertisement

Attempt to invoke virtual method ‘android.view.View com.google.android.exoplayer2.ui.PlayerView.findViewById(int)’ on a null object reference

the error is here: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method ‘android.view.View com.google.android.exoplayer2.ui.PlayerView.findViewById(int)’ on a null object reference at com.wk.videoplayer.PlayerActivity.onCreate(PlayerActivity.java:32)

Here is the XML code of activity_player.xml

JavaScript

and here is the PlayerActivity.java code:

JavaScript

please help me solve this error, I have already searched on stakoverflow for its solutions but I am not able to fix it please help me fix it.

Advertisement

Answer

very simple!!! change this code:

JavaScript

to:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement