1

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,901
  • 21
  • 84
  • 115
Kingyal
  • 63
  • 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

2

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
  • 32,980
  • 10
  • 97
  • 133