This example shares the specific code for using VideoView to play the resource files in the App for your reference. The specific content is as follows
Layout file
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:andro android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <VideoView android: android:layout_width="match_parent" android:layout_height="match_parent" /> </LinearLayout>
First create a new folder raw under res, and then copy the video to the folder.
Specific implementation code
public class VideoActivity extends Activity{ VideoView videoView; @Override protected void onCreate(Bundle savedInstanceState) { (savedInstanceState); setContentView(.activity_video); initView(); } public void initView(){ videoView= (VideoView) findViewById(.vv_video); playVideo(); } public void playVideo(){ //String file=().getPath()+"/oppo.3gp";//oppo.3gp video playback name String uri = "://" + getPackageName() + "/" + ; ((uri)); MediaController mc = new MediaController(this); //Set the controller to control which videoview is it (videoView); //Set the videoview controller to mc (mc); (); } }
The above is all the content of this article. I hope it will be helpful to everyone's study and I hope everyone will support me more.