android WebView 启用javaScript
package com.qiaoning;
import com.sglnetwork.android.voicepay.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.Toast;
public class BindGuidActivity extends Activity{
//widget
private WebView guideWebView = null;
private Button btnBack = null;
private WebSettings webSettings = null;
//val
private String strURL = "";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.bind_guid_layout);
initWidget();
initData();
}
private void initWidget(){
guideWebView = (WebView)findViewById(R.id.guideWebView);
webSettings = guideWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
btnBack = (Button)findViewById(R.id.btnBack);
btnBack.setOnClickListener(btnBackClickListener);
}
private void initData(){
strURL = "http://www.zzzyk.com";
guideWebView.loadUrl(strURL);
Toast.makeText(BindGuidActivity.this, R.string.loading_url, Toast.LENGTH_LONG).show();
}
View.OnClickListener btnBackClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
BindGuidActivity.this.finish();
}
};
}
摘自 qiaoning13256的专栏
补充:移动开发 , Android ,