I am using ViewSwitcher to switch between EditText and TextView. When I click the TextView for the first time, it changes to EditText and then I have to click   EditText again so that the keyboard appears and I to be able to edit the text.
The behavior I want is to be able to edit the text from the first click on the TextView. I don't want the user to click twice each time they want to edit the text.
Is there any way to do that ?
Here is a sample of the code to make it more clear:
XML code
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".Trial">
    <ViewSwitcher xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/user_name_switcher"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="8dp"
        android:layout_marginTop="8dp">
        <TextView
            android:id="@+id/username_tv"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:paddingLeft="12dp"
            android:paddingTop="8dp"
            android:text="User Name"
            android:textColor="@android:color/black"
            android:textSize="18sp" />
        <EditText
            android:id="@+id/username_et"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:hint="User Name"
            android:inputType="textPersonName" />
    </ViewSwitcher>
    <Button
        android:id="@+id/save_btn"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_marginBottom="24dp"
        android:layout_marginTop="24dp"
        android:padding="12dp"
        android:text="save" />
</LinearLayout>
Java code
package com.example.test
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.ViewSwitcher;
public class Trial extends AppCompatActivity {
    TextView userNameTV;
    EditText userNameET;
    Button saveBtn;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_trial);
        userNameTV = findViewById(R.id.username_tv);
        userNameET = findViewById(R.id.username_et);
        saveBtn = findViewById(R.id.save_btn);
        saveBtn.setEnabled(false);
        userNameTV.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                textViewClicked();
                userNameET.setText(userNameTV.getText().toString());
            }
        });
        saveBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ViewSwitcher switcher = findViewById(R.id.user_name_switcher);
                switcher.showNext();
                saveBtn.setEnabled(false);
            }
        });
    }
    public void textViewClicked() {
        ViewSwitcher switcher = findViewById(R.id.user_name_switcher);
        switcher.showNext();
        saveBtn.setEnabled(true);
    }
}
 
    