I am very new to Android programming, so sorry if this is a simple problem.
I am trying to create a form for entering user data and I keep getting the following error:
"The window is already focused, ignoring focus enhancement: com.android.internal.view.IInputMethodClient$Stub$Proxy@6279d588 "
This is what my xml for the layout looks like:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:isScrollContainer="true"
android:layout_width="fill_parent"
android:layout_height="fill_parent">"
<LinearLayout
android:orientation="vertical"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_gravity="top">
<TextView
android:id="@+id/text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="This is a test\nsecond line\n"/>
<EditText android:id="@+id/name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:maxLength="30"
android:maxLines="1"
android:hint="@string/compose_name"></EditText>
<Button
android:id="@+id/new_contact_button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/submit" />
</LinearLayout>
</ScrollView>
And here is what my class file looks like:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.new_contact);
final EditText nameField = (EditText) findViewById(R.id.name);
nameField.setOnKeyListener(new View.OnKeyListener() {
public boolean onKey(View v, int keyCode, KeyEvent event) {
if ((event.getAction() == KeyEvent.ACTION_DOWN) &&
(keyCode == KeyEvent.KEYCODE_ENTER)) {
String strNicknameToSave = nameField.getText().toString();
return true;
}
return false;
}
});
submitButton = (Button) findViewById(R.id.new_contact_button);
submitButton.setOnClickListener(this);
}
If I get rid of the EditText field, then it works fine. In addition, it worked just fine once, but I couldn’t repeat it (all that I did, meanwhile, was deleting another layout that wasn’t in use).
Thank you for your help.
source
share