开发者

Problem in playing video :(

I have a list view and I want when the row get click it play video, my code is :

public void onItemClick(AdapterView<?> a, View v, int position, long id)
{
setContentView(R.layout.video);
VideoView videoview = (VideoView)findViewById(R.id.videoview);
MediaController mc = new MediaController(?);
videoview.setMediaController(mc);
开发者_JS百科    videoview.setVideoURI(Uri.parse((String) myList.getItemAtPosition(position)));
videoview.requestFocus();
    videoview.start();
}


Please use putExtra method in this Activity

protected void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);
    Object o = this.getListAdapter().getItem(position);
    String videouri= o.toString();

    Intent in = new Intent(getApplicationContext(), VideoExamplesActivity.class);   
    in.putExtra(KEY_NAME, videouri);

    startActivity(in);
    Toast.makeText(this, "You have chosen the videouri: " + " " + videouri, Toast.LENGTH_LONG).show();
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜