I cannot figure out how to add a space between every word the user types into an edittext as I am still a beginner. I have typed the obvious code below.

```
    findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            EditText editText = (EditText) findViewById(R.id.editText);
            EditText editText2 = (EditText) findViewById(R.id.editText2);
            editText2.setText(???);
        }
    });

```

In case it isn't obvious, there are seperate EditTexts. The user types into `edittext` and I am trying to get the text to "come out" in `edittext2` with the spaces added.

**Edit:** Here is the finished code if anyone wants it. I also added a bit that says how many spaces it's added.

```
EditText editText = (EditText) findViewById(R.id.editText);
                TextView editText2 = (TextView) findViewById(R.id.editText2);
                String str = editText.getText().toString();
                str = str.replace(" ", "  ");
                editText2.setText(str);

                String stre = editText2.getText().toString();
                String string = editText.getText().toString();
                int length = string.length();
                int lengthy = stre.length();

                int finale = lengthy - length;

                TextView result = (TextView) findViewById(R.id.textresult);
                result.setText( finale + " spaces have been added.");

```