I have a WebView app that I want to behave like this:
The user can follow any link and the new page is opened inside the same WebView, except if the target is YouTube in which case I want two possible scenarios:
- Open the YouTube Android app to view the video
- Open the standard browser to view the video.
My main activity is as follows:
package com.prgguru.android;
import android.os.Bundle;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.webkit.WebView;
@SuppressLint("SetJavaScriptEnabled")
public class MainActivity extends Activity {
WebView browser;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
browser=(WebView)findViewById(R.id.webkit);
browser.getSettings().setJavaScriptEnabled(true);
browser.getSettings().setDefaultFontSize(20);
browser.loadUrl("http://exo-agency.com/funnytube/");
}
}
Thanks in advance.