-1

i try to play a video in a VideoView, therefore i used the following code:

PlayVideo();
}


private void PlayVideo(){
    String urlPath = "android.resource://love.dominikhartlug.clate/"+R.raw.vido;
    Uri uri = Uri.parse(urlPath);

    vw.setVideoURI(uri);
    vw.start();
}
}

i return always the following error message:

.VideoView.setVideoURI(android.net.Uri)' on a null object reference

if i list all files from my raw folder, the file vido.mp4 does exist.

does anyone have a solution?

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Dominik
  • 419
  • 2
  • 6
  • 16

2 Answers2

1

have you initialized vw it looks like you haven't initialize vw that's its trowing null pointerbecause vw is null

nishant
  • 2,526
  • 1
  • 13
  • 19
0

Have you used findViewById to link it?

Abhishek Sengupta
  • 2,938
  • 1
  • 28
  • 35