我有一个程序,通过TextEdit从用户输入获取双倍并设置变量的值。一切正常,但每当我按下键盘上的Enter键时,我就会在logcat中得到它:
E/AmanattoDataUpdaterHelper﹕ Failed to get contextual suggestions.
E/AmanattoDataUpdaterHelper﹕ package name: myPackage.package
据我所知,这只发生在Android 5.1.1上。它不能在我的任何KitKat设备上执行。这是Lollipop的错误还是我做错了什么?
TextEdit的监听器:
final EditText cutout = (EditText) view.findViewById(R.id.driver_manager_cutout_dimensions);
cutout.setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if ((event.getAction() == KeyEvent.ACTION_DOWN) &&
(keyCode == KeyEvent.KEYCODE_ENTER)) {
ValueMaster.getInstance().setCutoutDim(
Double.parseDouble(cutout.getText().toString()));
Log.e("KICKU",""+ValueMaster.getInstance().getCutoutDim());
return true;
}
return false;
}
});
TextEdit的XML:
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical|left"
android:layout_gravity="center_vertical|left"
android:inputType="numberDecimal"
android:ems="@integer/builder_tab_parameters_number_box_size"
android:id="@+id/driver_manager_cutout_dimensions"/>