Programatically:

edittext.requestFocus();

Through xml:

<EditText...>
    <requestFocus />
</EditText>

Or call onClick method manually.


Yes, I got the answer.. just simply edit the manifest file as:

        <activity android:name=".MainActivity"
        android:label="@string/app_name"
        android:windowSoftInputMode="stateAlwaysVisible" />

and set EditText.requestFocus() in onCreate()..

Thanks..


youredittext.requestFocus() call it from activity

oncreate();

and use the above code there


It has worked for me as follows.

ed1.requestFocus();

            return; //Faça um return para retornar o foco