Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 20th, 2012  |  syntax: Java  |  size: 0.97 KB  |  hits: 31  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. import android.os.Bundle;
  2. import android.app.Activity;
  3. import android.graphics.Color;
  4. import android.view.Menu;
  5. import android.webkit.WebView;
  6. import android.webkit.WebSettings.PluginState;
  7.  
  8. public class MainActivity extends Activity {
  9.  
  10.             WebView webview;
  11.  
  12.     @Override
  13.     public void onCreate(Bundle savedInstanceState) {
  14.         super.onCreate(savedInstanceState);
  15.         setContentView(R.layout.activity_main);
  16.  
  17.         webview=(WebView) findViewById(R.id.webview);
  18.         webview.getSettings().setJavaScriptEnabled(true);
  19.         webview.getSettings().setPluginState(PluginState.ON);
  20.         webview.getSettings().setPluginsEnabled(true);
  21.         webview.setBackgroundColor(Color.parseColor("#00000000"));
  22.  
  23.         String iframe=
  24.         "<iframe src=\"http://www.youtube.com/embed/rW1OChI-MWA\"
  25.             frameborder=\"0\"
  26.             allowfullscreen>
  27.         </iframe>";
  28.  
  29.         webview.loadData(iframe, "text/html", "utf-8");
  30.  
  31.      }
  32. }