List of usage examples for android.view.inputmethod InputMethodManager SHOW_IMPLICIT
int SHOW_IMPLICIT
To view the source code for android.view.inputmethod InputMethodManager SHOW_IMPLICIT.
Click Source Link
From source file:org.chromium.chrome.browser.autofill.CardUnmaskPrompt.java
private void setInitialFocus() { InputMethodManager imm = (InputMethodManager) mDialog.getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); View view = mShouldRequestExpirationDate ? mMonthInput : mCardUnmaskInput; imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT); view.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED); if (sObserverForTest != null) { sObserverForTest.onCardUnmaskPromptReadyForInput(this); }//w w w .ja v a 2 s . c o m }
From source file:com.vaquerosisd.projectmanager.TaskList.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { if (taskSelected) menu.findItem(R.id.actionBar_DeleteTaskIcon).setVisible(true); else/* ww w .j a v a 2s. c o m*/ menu.findItem(R.id.actionBar_DeleteTaskIcon).setVisible(false); if (searching) { getActionBar().setDisplayShowTitleEnabled(false); menu.findItem(R.id.actionBar_SearchTaskIcon).setVisible(false); menu.findItem(R.id.actionBar_SearchTaskItem).setVisible(true); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, 0); } else { getActionBar().setDisplayShowTitleEnabled(true); MenuItem searchItem = menu.findItem(R.id.actionBar_SearchTaskItem); final EditText searchProject = (EditText) searchItem.getActionView() .findViewById(R.id.actionBar_SearchItemEditText); searchProject.setText(""); menu.findItem(R.id.actionBar_SearchTaskIcon).setVisible(true); menu.findItem(R.id.actionBar_SearchTaskItem).setVisible(false); } MenuItem logMenuItem = menu.findItem(R.id.actionBar_Menu_user); if (currentUser != null) { logMenuItem.setTitle("Log Out from " + currentUser.getUsername()); } else { checkUser(); } return true; }
From source file:com.bt.download.android.gui.util.UIUtils.java
public static void showKeyboard(Context context, View view) { view.requestFocus();//w w w. j av a2 s . c o m InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT); }
From source file:ua.mkh.settings.full.MainActivity.java
@SuppressLint("NewApi") @Override/*from w w w .ja v a2 s. c o m*/ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //try { String roman = "fonts/Regular.otf"; String medium = "fonts/Medium.otf"; String bold = "fonts/Bold.otf"; String thin = "fonts/Thin.otf"; typefaceRoman = Typeface.createFromAsset(getAssets(), roman); typefaceMedium = Typeface.createFromAsset(getAssets(), medium); typefaceBold = Typeface.createFromAsset(getAssets(), bold); typefaceThin = Typeface.createFromAsset(getAssets(), thin); mSettings = getSharedPreferences(APP_PREFERENCES, Context.MODE_PRIVATE); ll1 = (LinearLayout) findViewById(R.id.ll1); ll1.requestFocus(); searchView = (SearchView) findViewById(R.id.search); searchView.setIconifiedByDefault(false); searchView.setOnQueryTextListener(this); searchView.setOnCloseListener(this); mListView = (ListView) findViewById(R.id.list); b1 = (Button) findViewById(R.id.button1); b2 = (Button) findViewById(R.id.button2); b11 = (Button) findViewById(R.id.button11); b21 = (Button) findViewById(R.id.button21); ed1 = (EditText) findViewById(R.id.EditText01); ed11 = (EditText) findViewById(R.id.EditText011); b21.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { b11.setVisibility(View.GONE); b21.setVisibility(View.GONE); ed11.clearFocus(); ed1.clearFocus(); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(ed1.getWindowToken(), 0); ed11.setText(""); ed1.setText(""); LinearLayout list_res_top = (LinearLayout) findViewById(R.id.list_res_top); list_res_top.setVisibility(View.GONE); LinearLayout list_res = (LinearLayout) findViewById(R.id.list_res); list_res.setVisibility(View.GONE); ll1.setVisibility(View.VISIBLE); sear = false; } }); ed1.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { b11.setVisibility(View.VISIBLE); b21.setVisibility(View.VISIBLE); LinearLayout list_res_top = (LinearLayout) findViewById(R.id.list_res_top); list_res_top.setVisibility(View.VISIBLE); LinearLayout list_res = (LinearLayout) findViewById(R.id.list_res); list_res.setVisibility(View.VISIBLE); sear = true; //ll1.setVisibility(View.INVISIBLE); ed11.requestFocus(); ed1.clearFocus(); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(ed11, InputMethodManager.SHOW_IMPLICIT); //LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); //lp.setMargins(0, 0, 0, 0); //ll1.setLayoutParams(lp); } else { ll1.setVisibility(View.GONE); b11.setVisibility(View.VISIBLE); LinearLayout list_res = (LinearLayout) findViewById(R.id.list_res); list_res.setVisibility(View.VISIBLE); //LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); //lp.setMargins(0, (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 39, getResources().getDisplayMetrics()), 0, 0); //ll1.setLayoutParams(lp); } } }); ed11.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence cs, int arg1, int arg2, int arg3) { // When user changed the Text searchView.setQuery(cs, false); mListView.setVisibility(View.VISIBLE); } @Override public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { } @Override public void afterTextChanged(Editable arg0) { } }); mDbHelper = new CustomersDbAdapter(this); mDbHelper.open(); /* //Clean all Customers mDbHelper.deleteAllCustomers(); */ ////////////////////// LinearLayoutWiFi = (LinearLayout) findViewById(R.id.LinearLayoutWiFi); LinearLayoutBluetooth = (LinearLayout) findViewById(R.id.LinearLayoutBluetooth); LinearLayoutSotSvyaz = (LinearLayout) findViewById(R.id.LinearLayoutSotSvyaz); LinearLayoutOperator = (LinearLayout) findViewById(R.id.LinearLayoutOperator); LinearLayoutGeo = (LinearLayout) findViewById(R.id.LinearLayoutGeo); LinearLayoutNotif = (LinearLayout) findViewById(R.id.LinearLayoutNotif); LinearLayoutControl = (LinearLayout) findViewById(R.id.LinearLayoutControl); LinearLayoutMail = (LinearLayout) findViewById(R.id.LinearLayoutMail); LinearLayoutNotes = (LinearLayout) findViewById(R.id.LinearLayoutNotes); LinearLayoutMessages = (LinearLayout) findViewById(R.id.LinearLayoutMessages); LinearLayoutPhone = (LinearLayout) findViewById(R.id.LinearLayoutPhone); LinearLayoutSafari = (LinearLayout) findViewById(R.id.LinearLayoutSafari); LinearLayoutMusic = (LinearLayout) findViewById(R.id.LinearLayoutMusic); LinearLayoutCompass = (LinearLayout) findViewById(R.id.LinearLayoutCompass); LinearLayoutWeather = (LinearLayout) findViewById(R.id.LinearLayoutWeather); LinearLayoutGameCenter = (LinearLayout) findViewById(R.id.LinearLayoutGameCenter); LinearLayoutPasscode = (LinearLayout) findViewById(R.id.LinearLayoutPasscode); LinearLayoutPrivacy = (LinearLayout) findViewById(R.id.LinearLayoutPrivacy); LinearLayoutApn = (LinearLayout) findViewById(R.id.LinearLayoutApn); LinearLayoutCloud = (LinearLayout) findViewById(R.id.LinearLayoutCloud); LinearLayoutTunes = (LinearLayout) findViewById(R.id.LinearLayoutTunes); LinearLayoutMaps = (LinearLayout) findViewById(R.id.LinearLayoutMaps); LinearLayoutVk = (LinearLayout) findViewById(R.id.LinearLayoutVk); LinearLayoutViber = (LinearLayout) findViewById(R.id.LinearLayoutViber); LinearLayoutOk = (LinearLayout) findViewById(R.id.LinearLayoutOK); LinearLayoutSkype = (LinearLayout) findViewById(R.id.LinearLayoutSkype); LinearLayoutWhatsapp = (LinearLayout) findViewById(R.id.LinearLayoutWhatsApp); LinearLayoutTwitter = (LinearLayout) findViewById(R.id.LinearLayoutTwitter); LinearLayoutFacebook = (LinearLayout) findViewById(R.id.LinearLayoutFacebook); LinearLayoutInstagram = (LinearLayout) findViewById(R.id.LinearLayoutInstagram); LinearLayoutNew1 = (LinearLayout) findViewById(R.id.LinearLayoutApp1); LinearLayoutNew2 = (LinearLayout) findViewById(R.id.LinearLayoutApp2); LinearLayoutNew3 = (LinearLayout) findViewById(R.id.LinearLayoutApp3); LinearLayoutNew4 = (LinearLayout) findViewById(R.id.LinearLayoutApp4); LinearLayoutNew1.setVisibility(View.GONE); LinearLayoutNew2.setVisibility(View.GONE); LinearLayoutNew3.setVisibility(View.GONE); LinearLayoutNew4.setVisibility(View.GONE); LinearLayoutGeo.setVisibility(View.GONE); LinearLayoutMail.setVisibility(View.GONE); LinearLayoutNotes.setVisibility(View.GONE); LinearLayoutMessages.setVisibility(View.GONE); LinearLayoutPhone.setVisibility(View.GONE); LinearLayoutSafari.setVisibility(View.GONE); LinearLayoutMusic.setVisibility(View.GONE); LinearLayoutCompass.setVisibility(View.GONE); LinearLayoutWeather.setVisibility(View.GONE); LinearLayoutGameCenter.setVisibility(View.GONE); LinearLayoutNotif.setVisibility(View.GONE); LinearLayoutControl.setVisibility(View.GONE); LinearLayoutTunes.setVisibility(View.GONE); LinearLayoutMaps.setVisibility(View.GONE); LinearLayoutVk.setVisibility(View.GONE); LinearLayoutViber.setVisibility(View.GONE); LinearLayoutOk.setVisibility(View.GONE); LinearLayoutSkype.setVisibility(View.GONE); LinearLayoutWhatsapp.setVisibility(View.GONE); LinearLayoutTwitter.setVisibility(View.GONE); LinearLayoutFacebook.setVisibility(View.GONE); LinearLayoutInstagram.setVisibility(View.GONE); textwifi = (TextView) findViewById(R.id.textwifi); textbt = (TextView) findViewById(R.id.textbt); TextOper = (TextView) findViewById(R.id.TextOper); textVPN = (TextView) findViewById(R.id.TextView01); wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE); btn_avia = (Button) findViewById(R.id.Button01); tb_am = (ToggleButton) findViewById(R.id.ToggleButton01); tb_am.setOnClickListener(this); btn_wifi = (Button) findViewById(R.id.ButtonWifi); btn_wifi.setOnClickListener(this); btn_bluetooth = (Button) findViewById(R.id.ButtonBluetooth); btn_bluetooth.setOnClickListener(this); btn_sota = (Button) findViewById(R.id.ButtonSota); btn_sota.setOnClickListener(this); startService(new Intent(this, NotificationService.class)); btn_operator = (Button) findViewById(R.id.ButtonOperator); btn_operator.setOnClickListener(this); btn_osnova = (Button) findViewById(R.id.ButtonOsnova); btn_osnova.setOnClickListener(this); btn_zvuki = (Button) findViewById(R.id.ButtonZvuki); btn_zvuki.setOnClickListener(this); btn_oboi = (Button) findViewById(R.id.ButtonOboi); btn_oboi.setOnClickListener(this); btn_gps = (Button) findViewById(R.id.ButtonGeo); btn_gps.setOnClickListener(this); btn_passcode = (Button) findViewById(R.id.ButtonPasscode); btn_passcode.setOnClickListener(this); btn_battery = (Button) findViewById(R.id.ButtonBattery); btn_battery.setOnClickListener(this); btn_privacy = (Button) findViewById(R.id.ButtonPrivacy); btn_privacy.setOnClickListener(this); btn_notification = (Button) findViewById(R.id.ButtonNotification); btn_notification.setOnClickListener(this); btn_control = (Button) findViewById(R.id.ButtonControl); btn_control.setOnClickListener(this); btn_disturb = (Button) findViewById(R.id.ButtonDisturb); btn_disturb.setOnClickListener(this); btn_mail = (Button) findViewById(R.id.ButtonMail); btn_mail.setOnClickListener(this); btn_notes = (Button) findViewById(R.id.ButtonNotes); btn_notes.setOnClickListener(this); btn_messages = (Button) findViewById(R.id.ButtonMessages); btn_messages.setOnClickListener(this); btn_phone = (Button) findViewById(R.id.ButtonPhone); btn_phone.setOnClickListener(this); btn_safari = (Button) findViewById(R.id.ButtonSafari); btn_safari.setOnClickListener(this); btn_music = (Button) findViewById(R.id.ButtonMusic); btn_music.setOnClickListener(this); btn_compass = (Button) findViewById(R.id.ButtonCompass); btn_compass.setOnClickListener(this); btn_weather = (Button) findViewById(R.id.ButtonWeather); btn_weather.setOnClickListener(this); btn_games = (Button) findViewById(R.id.ButtonGameCenter); btn_games.setOnClickListener(this); btn_maps = (Button) findViewById(R.id.ButtonMaps); btn_maps.setOnClickListener(this); btn_vk = (Button) findViewById(R.id.ButtonVk); btn_vk.setOnClickListener(this); btn_viber = (Button) findViewById(R.id.ButtonViber); btn_viber.setOnClickListener(this); btn_ok = (Button) findViewById(R.id.ButtonOk); btn_ok.setOnClickListener(this); btn_skype = (Button) findViewById(R.id.ButtonSkype); btn_skype.setOnClickListener(this); btn_whatsapp = (Button) findViewById(R.id.ButtonWhatsapp); btn_whatsapp.setOnClickListener(this); btn_twitter = (Button) findViewById(R.id.ButtonTwitter); btn_twitter.setOnClickListener(this); btn_facebook = (Button) findViewById(R.id.ButtonFacebook); btn_facebook.setOnClickListener(this); btn_instagram = (Button) findViewById(R.id.ButtonInstagram); btn_instagram.setOnClickListener(this); btn_new1 = (Button) findViewById(R.id.Button02); btn_new1.setOnClickListener(this); btn_new2 = (Button) findViewById(R.id.Button03); btn_new2.setOnClickListener(this); btn_new3 = (Button) findViewById(R.id.Button04); btn_new3.setOnClickListener(this); btn_new4 = (Button) findViewById(R.id.Button05); btn_new4.setOnClickListener(this); btn_vpn = (Button) findViewById(R.id.Button06); btn_vpn.setOnClickListener(this); btn_display = (Button) findViewById(R.id.ButtonDisplay); btn_display.setOnClickListener(this); btn_iCloud = (Button) findViewById(R.id.ButtonCloud); btn_iCloud.setOnClickListener(this); btn_iTunes = (Button) findViewById(R.id.ButtonTunes); btn_iTunes.setOnClickListener(this); buttonBack = (Button) findViewById(R.id.buttonBack); btn_menu_settings = (Button) findViewById(R.id.ButtonMenuSettings); btn_menu_cancel = (Button) findViewById(R.id.ButtonMenuCancel); textView1 = (TextView) findViewById(R.id.textView1); textView2 = (TextView) findViewById(R.id.textView2); textView3 = (TextView) findViewById(R.id.textView3); text_app_main = (TextView) findViewById(R.id.text_app_main); text_app_main.setText(R.string.text_app_name); ImageView imageView2 = (ImageView) findViewById(R.id.imageView2); imageView2.setVisibility(View.GONE); text_app_main.setTypeface(typefaceBold); btn_avia.setTypeface(typefaceRoman); //textView1.setTypeface(typefaceRoman); textView3.setTypeface(typefaceRoman); btn_wifi.setTypeface(typefaceRoman); btn_bluetooth.setTypeface(typefaceRoman); btn_sota.setTypeface(typefaceRoman); btn_operator.setTypeface(typefaceRoman); btn_osnova.setTypeface(typefaceRoman); btn_passcode.setTypeface(typefaceRoman); btn_battery.setTypeface(typefaceRoman); btn_privacy.setTypeface(typefaceRoman); btn_zvuki.setTypeface(typefaceRoman); btn_oboi.setTypeface(typefaceRoman); btn_notification.setTypeface(typefaceRoman); btn_control.setTypeface(typefaceRoman); btn_disturb.setTypeface(typefaceRoman); btn_gps.setTypeface(typefaceRoman); btn_mail.setTypeface(typefaceRoman); btn_notes.setTypeface(typefaceRoman); btn_messages.setTypeface(typefaceRoman); btn_phone.setTypeface(typefaceRoman); btn_safari.setTypeface(typefaceRoman); btn_music.setTypeface(typefaceRoman); btn_compass.setTypeface(typefaceRoman); btn_weather.setTypeface(typefaceRoman); btn_games.setTypeface(typefaceRoman); btn_new1.setTypeface(typefaceRoman); btn_new2.setTypeface(typefaceRoman); btn_new3.setTypeface(typefaceRoman); btn_new4.setTypeface(typefaceRoman); btn_vpn.setTypeface(typefaceRoman); btn_display.setTypeface(typefaceRoman); btn_maps.setTypeface(typefaceRoman); btn_vk.setTypeface(typefaceRoman); btn_viber.setTypeface(typefaceRoman); btn_ok.setTypeface(typefaceRoman); btn_skype.setTypeface(typefaceRoman); btn_whatsapp.setTypeface(typefaceRoman); btn_twitter.setTypeface(typefaceRoman); btn_facebook.setTypeface(typefaceRoman); btn_instagram.setTypeface(typefaceRoman); btn_iCloud.setTypeface(typefaceRoman); btn_iTunes.setTypeface(typefaceRoman); textwifi.setTypeface(typefaceRoman); textbt.setTypeface(typefaceRoman); TextOper.setTypeface(typefaceRoman); textVPN.setTypeface(typefaceRoman); //LinearLayoutPrivacy.setVisibility(View.GONE); //LinearLayoutApn.setVisibility(View.GONE); //LinearLayoutPasscode.setVisibility(View.GONE); //layoutTunes.setVisibility(View.GONE); //////////////////START/////////////////// ///////////////////APP////////////// pm = this.getPackageManager(); //Notification notif_inoty = pm.getLaunchIntentForPackage("net.suckga.inoty"); notif_espier = pm.getLaunchIntentForPackage("mobi.espier.launcher.plugin.notifications7pro"); //Control Center control_hi = pm.getLaunchIntentForPackage("com.hi.apps.studio.control.center"); control_espier = pm.getLaunchIntentForPackage("mobi.espier.launcher.plugin.controller7pro"); //Mail mail_stok = pm.getLaunchIntentForPackage("com.android.email"); //Phone phone_stok = pm.getLaunchIntentForPackage("com.android.dialer"); //Messages messages_stok = pm.getLaunchIntentForPackage("com.android.mms"); //Safari safari_stok = pm.getLaunchIntentForPackage("com.android.browser"); //Music; music_stok = pm.getLaunchIntentForPackage("com.android.music"); //VK vk_stok = pm.getLaunchIntentForPackage("com.vkontakte.android"); //Viber viber_stok = pm.getLaunchIntentForPackage("com.viber.voip"); //Ok ok_stok = pm.getLaunchIntentForPackage("ru.ok.android"); //Skype skype_stok = pm.getLaunchIntentForPackage("com.skype.raider"); //WhatsApp!!!! whatsapp_stok = pm.getLaunchIntentForPackage("com.whatsapp"); //Twitter twitter_stok = pm.getLaunchIntentForPackage("com.twitter.android"); //Facebook facebook_stok = pm.getLaunchIntentForPackage("com.facebook.katana"); //Instagram instagram_stok = pm.getLaunchIntentForPackage("com.instagram.android"); //Maps maps_stok = pm.getLaunchIntentForPackage("com.google.android.apps.maps"); bt = BluetoothAdapter.getDefaultAdapter(); //Check Availability of bluetooth if (bt == null) { LinearLayoutBluetooth.setVisibility(View.GONE); } }
From source file:io.romain.passport.ui.AddCityActivity.java
private void hideLoadingSpinner() { ObjectAnimator a = ObjectAnimator.ofFloat(mLoading, View.ALPHA, 1, 0); a.addListener(new SimpleAnimatorListener() { @Override/*from ww w . j av a 2s . c om*/ public void onAnimationEnd(Animator animation) { mLoading.setVisibility(View.GONE); } }); ObjectAnimator b = ObjectAnimator.ofFloat(mContainer, View.ALPHA, 0, 1); b.addListener(new SimpleAnimatorListener() { @Override public void onAnimationStart(Animator animation) { mContainer.setAlpha(0); mContainer.setVisibility(View.VISIBLE); mEditText.requestFocus(); mEditText.setError(getString(R.string.add_city_error)); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, 0); } }); AnimatorSet transition = new AnimatorSet(); transition.playTogether(a, b); transition.setDuration(300); transition.setInterpolator(AnimUtils.getFastOutSlowInInterpolator(this)); transition.start(); }
From source file:kr.wdream.storyshop.AndroidUtilities.java
public static void showKeyboard(View view) { if (view == null) { return;// ww w . java 2 s. c o m } try { InputMethodManager inputManager = (InputMethodManager) view.getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT); } catch (Exception e) { FileLog.e("tmessages", e); } }
From source file:io.github.hidroh.materialistic.BaseWebFragment.java
private void toggleSoftKeyboard(boolean visible) { InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); if (visible) { imm.showSoftInput(mEditText, InputMethodManager.SHOW_IMPLICIT); } else {/*from w ww . ja va 2 s . c o m*/ imm.hideSoftInputFromWindow(mEditText.getWindowToken(), 0); } }
From source file:com.google.android.apps.tvremote.PairingActivity.java
public void hideKeyboard() { InputMethodManager manager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); manager.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, 0); }
From source file:com.ferdi2005.secondgram.AndroidUtilities.java
public static void showKeyboard(View view) { if (view == null) { return;//from ww w . jav a2 s .c om } try { InputMethodManager inputManager = (InputMethodManager) view.getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT); } catch (Exception e) { FileLog.e(e); } }
From source file:com.tozny.e3db.android.DefaultKeyAuthenticator.java
@Override public void getPassword(final PasswordHandler handler) { this.activity.runOnUiThread(new Runnable() { @Override//from w w w. ja v a2 s . c om public void run() { Context ctx = DefaultKeyAuthenticator.this.activity; final EditText input = new EditText(ctx); input.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_PASSWORD); new AlertDialog.Builder(DefaultKeyAuthenticator.this.activity) .setMessage(ctx.getString(R.string.key_provider_please_enter_pin)) .setPositiveButton(ctx.getString(R.string.key_provider_ok), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { try { handler.handlePassword(input.getText().toString()); } catch (UnrecoverableKeyException e) { wrongPasswordCount[0]++; if (wrongPasswordCount[0] >= 3) { handler.handleError( new RuntimeException("Too many password tries.")); } else { Toast.makeText(DefaultKeyAuthenticator.this.activity, e.getMessage(), Toast.LENGTH_SHORT).show(); getPassword(handler); } } } }) .setNegativeButton(ctx.getString(R.string.key_provider_cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { handler.handleCancel(); } }) .setView(input).show(); input.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean b) { if (input.isEnabled() && input.isFocusable()) { input.post(new Runnable() { @Override public void run() { final InputMethodManager imm = (InputMethodManager) DefaultKeyAuthenticator.this.activity .getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(input, InputMethodManager.SHOW_IMPLICIT); } }); } } }); } }); }