Ich möchte ein Video mit einem VideoView
im Vollbildmodus in Android 5.1 spielen. Außerdem möchte ich das Video (und die Änderung der Aktivität) nach einer bestimmten Zeit (sagen wir 5 Minuten) anhalten. Wie kann ich das erreichen? Mein Plan ist folgender:Android-Video nach einer bestimmten Zeit stoppen
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:id="@+id/LinearLayout01"
android:layout_height="fill_parent"
android:paddingLeft="2px"
android:paddingRight="2px"
xmlns:android="http://schemas.android.com/apk/res/android"
android:paddingTop="2px"
android:paddingBottom="2px"
android:layout_width="fill_parent"
android:orientation="vertical">
<VideoView
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:id="@+id/VideoView" />
</LinearLayout>
Und der folgende Code:
import android.app.Activity;
import android.os.Bundle;
import android.widget.VideoView;
public class VideoViewDemo extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
VideoView videoView = (VideoView)findViewById(R.id.VideoView);
videoView.setVideoPath("/sdcard/test.mp4");
videoView.start();
}
}
Mögliche Duplikat [Wie nach einer Verzögerung in Android eine Methode aufrufen] (https://stackoverflow.com/questions/3072173/how-to-call-a-method-after-a-delay-in-android) – 0X0nosugar