0
我想在Android Studio中使用VideoView開發媒體播放器。我創建了一個名爲raw的文件夾,其內容是我想要在視頻視圖上顯示的視頻。但是,當我編寫R.raw.nameofvideo(本例中爲「雲」)時,該程序會以原始方式給出警告。視頻查看android studio
任何人都可以看到問題在哪裏?
public class MainActivity extends AppCompatActivity {
Button play;
Button pause;
Button reset;
VideoView video;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
play = (Button) findViewById(R.id.button);
pause = (Button) findViewById(R.id.button2);
reset = (Button) findViewById(R.id.button3);
video = (VideoView) findViewById(R.id.videoView);
}
public void onClickStart(View view)
{
String videoPath = "android.resource://com.example.andrea.video/"+R.raw.cloud;
Uri uri = Uri.parse(videoPath);
video.setVideoURI(uri);
video.start();
}
}
什麼是警告? – Adam