Java Code Examples for androidx.preference.EditTextPreference#getText()
The following examples show how to use
androidx.preference.EditTextPreference#getText() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SettingsPreferenceActivity.java From DeviceConnect-Android with MIT License | 6 votes |
private void createEncoderBitRatePreference() { EditTextPreference pref = findPreference("encoder_bit_rate"); if (pref != null) { pref.setSummaryProvider((Preference preference) -> pref.getText() + " Mbps" ); // 0以上の実数値以外の入力を禁止する pref.setOnBindEditTextListener((@NonNull EditText editText) -> editText.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL)); String value = pref.getText(); if (value == null) { pref.setText(Settings.DEFAULT_ENCODER_BITRATE_BASE); } } }
Example 2
Source File: RtspPreferenceActivity.java From DeviceConnect-Android with MIT License | 5 votes |
private String getStringFromEditText(int resId, int defaultId) { EditTextPreference editTextPreference = findPreference(getString(resId)); if (editTextPreference != null) { return editTextPreference.getText(); } return getString(defaultId); }
Example 3
Source File: SettingsPreferenceActivity.java From DeviceConnect-Android with MIT License | 5 votes |
private void createEncoderFrameRatePreference() { EditTextPreference pref = findPreference("encoder_frame_rate"); if (pref != null) { pref.setSummaryProvider((Preference preference) -> pref.getText() + " fps" ); // 0以上の整数値以外の入力を禁止する pref.setOnBindEditTextListener((@NonNull EditText editText) -> editText.setInputType(InputType.TYPE_CLASS_NUMBER)); String value = pref.getText(); if (value == null) { pref.setText(Integer.toString(Settings.DEFAULT_ENCODER_FPS)); } } }