List of usage examples for android.widget LinearLayout requestFocus
public final boolean requestFocus()
From source file:com.cerema.cloud2.ui.dialog.CredentialsDialogFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { // Create field for username mUsernameET = new EditText(getActivity()); mUsernameET.setHint(getActivity().getText(R.string.auth_username)); // Create field for password mPasswordET = new EditText(getActivity()); mPasswordET.setHint(getActivity().getText(R.string.auth_password)); mPasswordET.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); // Prepare LinearLayout for dialog LinearLayout ll = new LinearLayout(getActivity()); ll.setOrientation(LinearLayout.VERTICAL); ll.addView(mUsernameET);/*w w w .java2 s . c o m*/ ll.addView(mPasswordET); ll.requestFocus(); setRetainInstance(true); Builder authDialog = new AlertDialog.Builder(getActivity()) .setTitle(getActivity().getText(R.string.saml_authentication_required_text)).setView(ll) .setCancelable(false).setPositiveButton(R.string.common_ok, this) .setNegativeButton(R.string.common_cancel, this); Dialog d = authDialog.create(); d.getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE); return d; }
From source file:ch.uzh.supersede.feedbacklibrary.FeedbackActivity.java
@Override protected void onStart() { super.onStart(); LinearLayout emptyLayout = (LinearLayout) findViewById(R.id.supersede_feedbacklibrary_empty_layout); if (emptyLayout != null) { emptyLayout.requestFocus(); }//from w w w . ja v a 2 s .c om }