Code example for WebView

Methods: getSettingspostUrlsetScrollBarStylesetWebViewClient

0
		setContentView(R.layout.history);
		sp = getSharedPreferences(TTCConfig.SP_NAME, 0); 
		String url = "http://my.tagit.com.au/appLogin";
		 
		wv = (WebView)findViewById(R.id.wv);
		wv.getSettings().setJavaScriptEnabled(true);
	    wv.setScrollBarStyle(0);
	    wv.setWebViewClient(new WebViewClient(){
	    	 public boolean shouldOverrideUrlLoading(final WebView view, final String url) {
	            	view.loadUrl(url);
	                return true;    
	            } 
	    }); 
	    DateFormat df = DateFormat.getTimeInstance();
		df.setTimeZone(TimeZone.getTimeZone("gmt"));
		String gmtTime = df.format(new Date());
		String un = sp.getBoolean("auto_login", false)?sp.getString("username", "") : "";
		String pw = sp.getBoolean("auto_login", false)?sp.getString("password", "") : "";
		TelephonyManager t1 = (TelephonyManager) getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE);
 	    String imei = t1.getDeviceId();
 	    String postData = "username=" + un + "&password=" + pw +
 	    		"&time=" + gmtTime + "&imei=" + imei + "&page=history";
 	    wv.postUrl(url, EncodingUtils.getBytes(postData, "BASE64"));
	    //wv.loadUrl(url); 
	} 
	 
	 
} 
Experience pair programming with AI  Get Codota for Java