package com.example.user.simpleui;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

    TextView textView;
    Button button;
    EditText editText;
    boolean submitted;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        textView = (TextView)findViewById(R.id.textView);
        button = (Button)findViewById(R.id.button);
        editText = (EditText)findViewById(R.id.editText);
        textView.setText(R.string.app_name);
    }

    public void submit(View view) {
        if (!submitted) {
            textView.setText("You submitted: " + editText.getText());
            button.setText(R.string.button_unsubmit);
            submitted = true;
        } else {
            textView.setText(R.string.app_name);
            button.setText(R.string.button_submit);
            submitted = false;
        }
    }
}

@@ -104,16 +104,46 @@
 Bundle;%0A
+import android.view.KeyEvent;%0A
 import a
@@ -771,24 +771,436 @@
 g.app_name);
+%0A%0A        editText.setOnKeyListener(new View.OnKeyListener() %7B%0A            @Override%0A            public boolean onKey(View v, int keyCode, KeyEvent event) %7B%0A                if (keyCode == KeyEvent.KEYCODE_ENTER%0A                && event.getAction() == KeyEvent.ACTION_DOWN) %7B%0A                    submit(v);%0A                    return true;%0A                %7D%0A                return false;%0A            %7D%0A        %7D);
 %0A    %7D%0A%0A    
@@ -1327,16 +1327,50 @@
 ext());%0A
+            editText.setText(%22%22);%0A
         

Change enter key behavior