Archive for 2014
this is a test post so dont freak out. code will be posted here.
package Webview.droidgyaan.in; import android.os.Bundle; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import android.app.Activity; public class MainActivity extends Activity { private WebView mWebView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mWebView = (WebView) findViewById(R.id.activity_main_webview); //Enables JavaScript WebSettings webSettings = mWebView.getSettings(); webSettings.setJavaScriptEnabled(true); mWebView.setWebViewClient(new WebViewClient()); mWebView.loadUrl("http://www.droidgyaan.in"); } @Override // Detect when the back button is pressed public void onBackPressed() { if(mWebView.canGoBack()) { mWebView.goBack(); } else { // Let the system handle the back button super.onBackPressed(); } } }So this is how you code..