要加载视频文件夹下的视频文件吗?
试试下面的方法:
File raw_root_dir=new File(your_sdcard_raw_folder_path);
String[] sdcard_raw_dir=raw_root_dir.list();
if(raw_root_dir!=null){
for(String raw_file:sdcard_raw_dir){
mRawList.add(your_sdcard_raw_folder_path+raw_file);
}
}
我的英语很逊,我来自中国。: )
2009/8/13, zeeshan <[email protected]>:
>
> Hi Dear,
>
> i am trying to play a video in my activity before i load my main page
> of my application.
>
> i have created another activity PlayIntro as follows
>
> private void playVideo() {
> try {
>
> /*
> * TODO: Set the path variable to a local media
> file path.
> */
> path = "/sdcard/intro.mp4";
>
>
> // Create a new media player and set the listeners
> mMediaPlayer = new MediaPlayer();
> mMediaPlayer.setDataSource(path);
> mMediaPlayer.setDisplay(holder);
> mMediaPlayer.prepare();
> mMediaPlayer.setOnBufferingUpdateListener(this);
> mMediaPlayer.setOnCompletionListener(this);
> mMediaPlayer.setOnPreparedListener(this);
> mMediaPlayer.setAudioStreamType
> (AudioManager.STREAM_MUSIC);
>
>
> } catch (Exception e) {
> Log.e(TAG, "error: " + e.getMessage(), e);
> }
> }
>
>
>
> /////////////////////
>
> it does play the video and i call finish(); on completion.
>
> now the problem is :
> i have video in my raw folder rather than in my sdcard. how can i load
> from raw folder
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---