play mp4 from sdcard of emulator 2.2 -
public class mainactivity extends activity{
mediacontroller mediacontroller; mediaplayer mp; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); setrequestedorientation(activityinfo.screen_orientation_landscape); // uri uri = uri.parse("android.resource//org.me.vid_sample/raw/lahainaharbor"); file path = new file("/sdcard/waileasuntest1.mp4"); videoview videoview = (videoview) findviewbyid(r.id.surface); videoview.setvideopath(path.getabsolutepath()); mediacontroller = new mediacontroller(this); mediacontroller.setmediaplayer(videoview); mediacontroller.setanchorview(videoview); videoview.setmediacontroller(mediacontroller); videoview.requestfocus(); videoview.start(); }
check in device. sure works.
Comments
Post a Comment