Guest User

Untitled

a guest
Feb 4th, 2016
139
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.example.softbzero.xenoxd;
  2.  
  3. import com.google.android.gms.ads.AdRequest;
  4. import com.google.android.gms.ads.AdView;
  5.  
  6. import android.os.Bundle;
  7. import android.support.v7.app.AppCompatActivity;
  8. import android.view.Menu;
  9. import android.view.MenuItem;
  10. import android.webkit.WebSettings;
  11. import android.webkit.WebView;
  12. import android.webkit.WebViewClient;
  13. import android.widget.Toast;
  14.  
  15.  
  16.  
  17.  
  18. public class MainActivity extends AppCompatActivity {
  19.  
  20.  
  21.     @Override
  22.     protected void onCreate(Bundle savedInstanceState) {
  23.         super.onCreate(savedInstanceState);
  24.         setContentView(R.layout.activity_main);
  25.  
  26.         // Load an ad into the AdMob banner view.
  27.         AdView adView = (AdView) findViewById(R.id.adView);
  28.         AdRequest adRequest = new AdRequest.Builder()
  29.                 .setRequestAgent("android_studio:ad_template").build();
  30.         adView.loadAd(adRequest);
  31.  
  32.  
  33.         WebView htmlWebView = (WebView)findViewById(R.id.webView);
  34.         htmlWebView.setWebViewClient(new CustomWebViewClient());
  35.         WebSettings webSetting = htmlWebView.getSettings();
  36.         webSetting.setJavaScriptEnabled(true);
  37.         webSetting.setDisplayZoomControls(true);
  38.         htmlWebView.loadUrl("http://monitor.xenobot.net");
  39.  
  40.     }
  41.  
  42.  
  43.     @Override
  44.     public boolean onCreateOptionsMenu(Menu menu) {
  45.         // Inflate the menu; this adds items to the action bar if it is present.
  46.         getMenuInflater().inflate(R.menu.menu_main, menu);
  47.         return true;
  48.     }
  49.  
  50.     @Override
  51.     public boolean onOptionsItemSelected(MenuItem item) {
  52.         // Handle action bar item clicks here. The action bar will
  53.         // automatically handle clicks on the Home/Up button, so long
  54.         // as you specify a parent activity in AndroidManifest.xml.
  55.         int id = item.getItemId();
  56.  
  57.         if (id == R.id.action_settings) {
  58.             return true;
  59.         }
  60.  
  61.         return super.onOptionsItemSelected(item);
  62.     }
  63.  
  64.     private class CustomWebViewClient extends WebViewClient {
  65.         @Override
  66.         public boolean shouldOverrideUrlLoading(WebView view, String url) {
  67.             view.loadUrl(url);
  68.             return true;
  69.         }
  70.     }
  71. }
RAW Paste Data