1

Followed stackoverflow discussion Android YouTube app Play Video Intent

I tried this code but it didn't work

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.youtube.com/watch?v=cxLG2wtE7TM")));

I got this error in console but no output in logcat:

[2012-11-20 17:49:21 - Youtube] Installation failed due to invalid URI!
[2012-11-20 17:49:21 - Youtube] Please check logcat output for more details.
[2012-11-20 17:49:22 - Youtube] Launch canceled!

Logcat doesn't have any error record.....

Community
  • 1
  • 1
ParijatDev
  • 85
  • 2
  • 10

1 Answers1

2

This might help you:

Link

There is a slight suggestive change in the code that you have posted

Community
  • 1
  • 1
kittu88
  • 2,451
  • 5
  • 40
  • 80
  • that is the first part of the uri after which you have to supply the video id – kittu88 Nov 20 '12 at 12:47
  • btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String videoId = "rNBptkh5NHg&feature=g-all-u"; Intent intent = new Intent( Intent.ACTION_VIEW, Uri.parse("http://www.youtube.com/watch?v=" + videoId)); intent.putExtra("VIDEO_ID", videoId); startActivity(intent); } }); This is my code. on button click a blank page opens. I have internet permissions in manifest. wats d problem then? plz suggest – ParijatDev Nov 20 '12 at 12:52
  • Somebody please post a working version of youtube video in android. I need it urgently. – ParijatDev Nov 21 '12 at 06:05