java - How to set videoView inside Fragment in android -
how set videoview inside fragment. pushed a.mp4 file inside file explorer. 3 error shows 1. method findviewbyid(int) undefined type videos. 2. constructor mediacontroller(videos) undefined. 3. create method getwindowmanager(). please me how set videoview inside fragment.
public class videos extends fragment { videoview video_player_view; surfaceview sur_view; mediacontroller media_controller; displaymetrics dm; public videos() {} @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view rootview = inflater.inflate(r.layout.frag_videos, container, false); return rootview; } public void getinit() { video_player_view = (videoview)findviewbyid(r.id.videoview1); media_controller = new mediacontroller(this); dm = new displaymetrics(); this.getwindowmanager().getdefaultdisplay().getmetrics(dm); int height = dm.heightpixels; int width = dm.heightpixels; video_player_view.setminimumheight(height); video_player_view.setminimumwidth(width); video_player_view.setmediacontroller(media_controller); video_player_view.setvideopath("/mnt/sdcard/a.mp4"); video_player_view.start(); } }
Comments
Post a Comment