I am a noob so example are best. I have used the simple code for using
a webview but if i click on a link that points to a media file nothing
happens. I'd like to be able to stream audio or video from the webview
like it does in the browser but without opening the browser. How can I
get that functionality to work?
code:
import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class WebViewdemo extends Activity {
/** Called when the activity is first created. */
WebView webview;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
webview = (WebView) findViewById(R.id.webview);
webview.setWebViewClient(new webviewClient());
webview.getSettings().setJavaScriptEnabled(true);
webview.getSettings().setPluginsEnabled(true);
webview.loadUrl("http://google.com");
}
private class webviewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView
view,String url){
view.loadUrl(url);
return true;
}
}
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_BACK) &&webview.canGoBack
()) {
webview.goBack();
return true;
}
return super.onKeyDown(keyCode, event);
}
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en