Android: problem creating user form from a menu
<p>I'm very new to programming in Android, but have been struggling all day with a problem and would appreciate your help.</p>

<p>I'm trying to create a form to get user information (essentially a new contact) which is accessed from the menu.  When I click the button to create the new form, I get the following error:</p>

<blockquote>
  <p>"Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@626fd5e0"</p>
</blockquote>

<p>This is my code:<br>
The menu xml:</p>

<pre><code>&lt;menu xmlns:android="http://schemas.android.com/apk/res/android"&gt;
    &lt;item android:id="@+id/search"
        android:title="@string/settings_search"
        android:alphabeticShortcut="@string/settings_shortcut_search" /&gt;
    &lt;item android:id="@+id/new_contact"
        android:title="@string/settings_new"
        android:alphabeticShortcut="@string/settings_shortcut_new" /&gt;
&lt;/menu&gt;
</code></pre>

<p>The code for calling the new activity:  </p>

<pre><code>@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.new_contact:
        //activities to create a new account
        //startActivity(new Intent(this, Prefs.class));


            Intent i = new Intent(MainActivity.this, NewContact.class);
            startActivity(i);
            //addSaver("String");
            return true;
        case R.id.search:

            return true;
    // More items go here (if any) ...
    }
    return false;
}
</code></pre>

<p>The view for the new contact activity:</p>

<pre><code>&lt;ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"&gt;"
    &lt;LinearLayout
        android:orientation="vertical"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:layout_gravity="top"&gt;
        &lt;TextView
            android:id="@+id/text"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="This is a test\nsecond line\n"/&gt;
       &lt;Button
            android:id="@+id/new_contact_button"
            android:layout_height="wrap_content"
            android:text="@string/submit" /&gt;

    &lt;/LinearLayout&gt;
&lt;/ScrollView&gt;
</code></pre>

<p>And the code for the new activity:</p>

<pre><code>public class NewContact extends Activity implements OnClickListener {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.new_contact);

        // Set up click listeners for all the buttons
        View newContactButton = findViewById(R.id.new_contact_button);
        newContactButton.setOnClickListener(this);
    }
</code></pre>

<p>Bizarrely if I comment out the button from the class and from the xml then it works correctly and opens up the new activity (but of course I can't do anything with that activity).</p>
