Problème lors de l'affichage d'une vidéo.
Bonjour,
Je veut afficher une video dans mon application mobile et j'utilise la methode parse mais une erreur m'affiche "Cannot resolve method 'parse(java.lang.string)" , c'est quoi la solution !!
Merci pour votre répponse
Cordialement
Application Mobile Android
voici mon Code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| package cothink.cothink;
import android.app.Activity;
import android.graphics.PixelFormat;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.VideoView;
import java.net.URL;
public class VideoActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.content_video);
Button buttonPlayVideo2 = (Button)findViewById(R.id.button1);
getWindow().setFormat(PixelFormat.UNKNOWN);
//Display a video file
VideoView mVideoView2 = (VideoView)findViewById(R.id.videoView1);
String urlPath2 = "android.resource://cothink.cothink/"+R.raw.cothinkvideo;
URL url2 = URL.parse(urlPath2);
mVideoView2.setVideoURI(url2);
mVideoView2.requestFocus();
mVideoView2.start();
buttonPlayVideo2.setOnClickListener(new Button.OnClickListener(){
@Override
public void onClick(View v){
VideoView mVideoView2 = (VideoView) findViewById(R.id.videoView1);
String urlPath = "android.resource://cothink.cothink/"+R.raw.cothinkvideo;
URL url2 = URL.parse(urlPath);
mVideoView2.setVideoURI(url2);
mVideoView2.requestFocus();
mVideoView2.start();
}
});
}
} |
Application Mobile Android
Bonjour,
Merci Probléme résolu, si je veut faire une bouton aux milieux de video pour démarrer ou l'aréter c'est quoi la solution !
Cordialement