我在我的应用程序的webview中使用谷歌表单,它工作得很好,直到我今天早上看到键盘没有出现用户输入。
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class AndroidMobileAppSampleActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final WebView mainWebView = (WebView) findViewById(R.id.mainWebView);
WebSettings webSettings = mainWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
mainWebView.setWebViewClient(new WebViewClient());
mainWebView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
mainWebView.loadUrl("https://docs.google.com/forms/d/1Q3Ld-JwtrxSAlw-7mcVcEYH4kohCSqhzRZ9SHsRyu_U/viewform?usp=send_form");
{
mainWebView.setWebViewClient(new WebViewClient() {
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
mainWebView.loadUrl("file:///android_asset/b.txt");
}
});
class MyCustomWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
}
}}}
这是logcat
11-28 11:55:43.249:W / ActivityManager(591):getTasks:调用者10108不持有GET_TASKS;限制输出
11-28 11:55:44.300:W / ActivityManager(591):getTasks:调用者10108不持有GET_TASKS;限制输出
11-28 11:55:45.352:W / ActivityManager(591):getTasks:调用者10108不持有GET_TASKS;限制输出
11-28 11:55:46.416:W / ActivityManager(591):getTasks:调用者10108不持有GET_TASKS;限制输出
11-28 11:55:47.468:W / ActivityManager(591):getTasks:调用者10108不持有GET_TASKS;限制输出
11-28 11:55:48.521:W / ActivityManager(591):getTasks:调用者10108不持有GET_TASKS;限制输出
11-28 11:55:49.571:W / ActivityManager(591):getTasks:调用者10108不持有GET_TASKS;限制输出
11-28 11:55:50.623:W / ActivityManager(591):getTasks:调用者10108不持有GET_TASKS;限制输出
11-28 11:55:51.675:W / ActivityManager(591):getTasks:调用者10108不持有GET_TASKS;限制输出
11-28 11:55:52.726:W / ActivityManager(591):getTasks:调用者10108不持有GET_TASKS;限制输出
11-28 11:55:53.777:W / ActivityManager(591):getTasks:调用者10108不持有GET_TASKS;限制输出
11-28 11:55:54.829:W / ActivityManager(591):getTasks:调用者10108不持有GET_TASKS;限制输出
11-28 11:55:55.806:E / WifiStateMachine(591):WifiStateMachine CMD_START_SCAN source -2 txSuccessRate = 0.00 rxSuccessRate = 7.86 targetRoamBSSID = any RSSI = -44
11-28 11:55:55.808:I / wpa_supplicant(5496):wlan0:CTRL-EVENT-SCAN-STARTED
11-28 11:55:55.880:W / ActivityManager(591):getTasks:调用者10108不持有GET_TASKS;限制输出
11-28 11:55:56.924:W / ActivityManager(591):getTasks:调用者10108不持有GET_TASKS;限制输出
答案 0 :(得分:1)
你用什么级别的api进行测试?
android api 21有bug未解决。这出现在logcat输出中:
W/ActivityManager﹕ getTasks: caller 10077 does not hold GET_TASKS; limiting output
据我所知,当调用以下代码时会出现问题:
ActivityManager am = (ActivityManager) this.getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningTaskInfo> taskInfo = am.getRunningTasks(5);
我添加版本检查时解决了:
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)
答案 1 :(得分:0)
您只能在AndroidManifest.xml中添加此行
<uses-permission android:name="android.permission.GET_TASKS" />
我希望你能解决这个问题。