After a lot of search I found various solution of this question but that solution not works for me .I use this link , but not works for me and i also use this link it also not works for me. Please help me . I am compltely stuck here.
I use following code : from an activity I called a dialog like that :
FirstStartDialog dialog=new FirstStartDialog(this);
dialog.show();
then my Dialog class like that :
public class FirstStartDialog extends AlertDialog{
public FirstStartDialog(final MainWindow mainWindow,
) {
super(mainWindow);
}
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.new_account_dialog);
//getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
editText_registration_username = (EditText) findViewById(R.id.etxt_User_Name);
editText_registration_password = (EditText) findViewById(R.id.etxt_Password);
_btn_registration_next = (Button) findViewById(R.id.btn_registration_next);
_tap_here_registration = (TextView) findViewById(R.id.txt_Tap_Here_Message);
_relative_Main_new_Account = (RelativeLayout) findViewById(R.id.relative_Main_New_Account);
editText_login_username = (EditText) findViewById(R.id.etxt_Existing_User_Name);
editText_login_password = (EditText) findViewById(R.id.etxt_Exiting_User_Password);
_btn_login_next = (Button) findViewById(R.id.btn_login_next);
_tap_here_login = (TextView) findViewById(R.id.txt_Tap_Here_Existing);
_relative_Main_Existing_Account = (RelativeLayout) findViewById(R.id.relative_Main_Existing_Account);
editText_registration_username.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
FirstStartDialog.this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
}
}
});
editText_registration_password.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
FirstStartDialog.this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
}
}
});
}
}
In xml file i define my EditText like that :
<EditText
android:id="@+id/etxt_Password"
android:layout_width="210dp"
android:layout_height="22dp"
android:layout_marginTop="5dp"
android:hint="Password"
android:paddingLeft="8dp"
android:textColor="@android:color/black"
android:paddingRight="8dp"
android:textCursorDrawable="@null"
android:gravity="center_vertical"
android:textSize="12sp"
android:layout_below="@+id/etxt_User_Name"
android:layout_centerHorizontal="true"
android:background="@drawable/login_new_account_editbox"
/>
Please help me.