HTMLファイルを操作したいのですが、デプロイ時に実行しましたが、うまくいきません(入力HTMLページを表示する必要がありますが、デプロイ時にWebページが利用できないことを示しています)!エラーメッセージもログにありません!助けてください。私がやっている間違っているのはどこですか?
public class TestActivity extends Activity {
/** Called when the activity is first created. */
WebView webView =null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
webView =(WebView)findViewById(R.id.web);
webView.getSettings().setJavaScriptEnabled(true);
webView.setWebChromeClient(new WebChromeClient());
webView.loadUrl("file:///android-assets/www/index.html");
}
}
ここに私のJavaScript。
function sayhello(){
alert("hi", document.getElementById('name'),value);
}
そしてhtmlファイルはここにあります
<!DOCTYPE html>
<html>
<head>
<script src="index.js"></script>
</head>
<body>
What is ur name ?
<input id="name" value="">
<button onclick="sayhello()">say hello</button>
</body>
</head>
</html>
そしてレイアウト
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<WebView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/web"
android:text="@string/hello"
/>
</LinearLayout>