0

My app package name is com.example.app.a, I try to play the mp4 resource from application b com.example.app.b like this:

        VideoView videoView = (VideoView) findViewById(R.id.picker);
    videoView.setVideoURI(Uri.parse("android.resource://com.example.app.b/raw/keyboard_anim_theme"));
    videoView.requestFocus();
    videoView.start();

but the Can't play this video dialog shows. How can I play the mp4 in another application. Thanks a lot.

Phantômaxx
  • 37,352
  • 21
  • 80
  • 110
Kingyal
  • 53
  • 8
  • Possible duplicate of [Getting resources of another Application](https://stackoverflow.com/questions/7205415/getting-resources-of-another-application) – lucidbrot Jan 26 '18 at 10:39

1 Answers1

1

Have you tried with getIdentifier ?

check below code and check.

int rawId = getResources().getIdentifier("keyboard_anim_theme",  "raw", "com.example.app.b");
String path = "android.resource://com.example.app.b/" + rawId;
videoView.requestFocus();
videoView.start();
Niranj Patel
  • 36,011
  • 11
  • 98
  • 132