Android Application Programming
Tips & Tricks
Wednesday, June 4, 2014
How to open a new layout after button click in android
Use the below code,
Button next = (Button) findViewById(R.id.mybutton1);
next.setOnClickListener(new View.OnClickListener()
{
public void onClick(View view)
{
Intent myIntent = new Intent(view.getContext(), my_activity.class);
startActivityForResult(myIntent, 0);
}
});
How to write static HTML code in WebView control
Apply the below code,
webView = (WebView) findViewById(R.id.webView1);
webViewSettings = webView.getSettings();
webViewSettings.setJavaScriptCanOpenWindowsAutomatically(true);
webViewSettings.setJavaScriptEnabled(true);
webViewSettings.setBuiltInZoomControls(true);
webViewSettings.setPluginState(PluginState.ON);
webView.getSettings().setJavaScriptEnabled(true);
String data
="<h1>welcome to Android example..Write your own HTML code here..</h1><br>";
webView.loadData(
data
, "text/html","utf-8");
Newer Posts
Older Posts
Home
Subscribe to:
Posts (Atom)