0
我正在爲我的網站開發一個應用程序。我正在使用WebView在我的應用程序中打開網站。其他一切工作正常。但是,每當我嘗試點擊網站中的瀏覽按鈕(通過我的應用程序中的webview運行),那麼它不起作用。 Logcat顯示此消息。 嘗試刪除非JNI本地引用,傾銷線程請幫助我。還有我怎麼可以讓應用程序爲我在很短的時間網站...瀏覽按鈕不能在WebView中工作android
public class Temporary extends Activity {
private WebView wv;
private ValueCallback<Uri> mUploadMessage;
private final static int FILECHOOSER_RESULTCODE = 1;
@Override
protected void onActivityResult(int requestCode, int resultCode,
Intent intent) {
if (requestCode == FILECHOOSER_RESULTCODE) {
if (null == mUploadMessage) return;
Uri result = intent == null || resultCode != RESULT_OK ? null
: intent.getData();
mUploadMessage.onReceiveValue(result);
mUploadMessage = null;
}
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
wv = new WebView(this);
wv.loadUrl("My URl"); //I do not want to show real url
wv.getSettings().setJavaScriptEnabled(true);
wv.setWebViewClient(new WebViewClient());
wv.setWebChromeClient(new WebChromeClient() {
//The undocumented magic method override
//Eclipse will swear at you if you try to put @Override here
public void openFileChooser(ValueCallback<Uri> uploadMsg) {
mUploadMessage = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("image/*");
Temporary.this.startActivityForResult(Intent.createChooser(i, "File Chooser"), FILECHOOSER_RESULTCODE);
}
});
setContentView(wv);
}
}
是任何明顯的權限要求,除了這些:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" >
</uses-permission>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
請幫助:)
此瀏覽按鈕根本不起作用,如圖所示