-1

I'm creating video music search in android WebView and I wanted users can launch the android Youtube Application after clicked on search result in WebView.

Example:

  • Activity A Listed search result after user enter search text
  • Activity B launching youtube application with search result that user clicked from Activity A.

Anyway body know how to do this?

Regards,

SopheakVirak
  • 961
  • 6
  • 14
  • 36

1 Answers1

0

You can start a youtube video in the default player with this

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("{url}")));

Replace {url} with the youtube URL

See this question on how to intercept click in a webview so you can call the above when certain URLs are clicked

Community
  • 1
  • 1
tsukimi
  • 1,605
  • 2
  • 21
  • 36
  • Dear tsukimi, so, how can i post value from URL to startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("{url}"))); from WebView. Example: URL from search result are: (1)Result1 , (2)Result2 , (3)Result2 – SopheakVirak Jun 26 '12 at 04:28
  • The {url} is a URL to a you tube video, it looks like `http://www.youtube.com/watch?v={id}` do you have the video Id in your list? substitute the {id} with it. – tsukimi Jun 26 '12 at 04:40