android-edittext

How to check edittext's text is email address or not?

别来无恙 提交于 2019-12-17 04:40:45
问题 how to check the text of edittext is email address or not without using javascript and regular expression? Here I used inputtype="textEmailAddress" this is working but no error message is display. 回答1: /** * method is used for checking valid email id format. * * @param email * @return boolean true for valid false for invalid */ public static boolean isEmailValid(String email) { String expression = "^[\\w\\.-]+@([\\w\\-]+\\.)+[A-Z]{2,4}$"; Pattern pattern = Pattern.compile(expression, Pattern

How to check edittext's text is email address or not?

不羁的心 提交于 2019-12-17 04:40:10
问题 how to check the text of edittext is email address or not without using javascript and regular expression? Here I used inputtype="textEmailAddress" this is working but no error message is display. 回答1: /** * method is used for checking valid email id format. * * @param email * @return boolean true for valid false for invalid */ public static boolean isEmailValid(String email) { String expression = "^[\\w\\.-]+@([\\w\\-]+\\.)+[A-Z]{2,4}$"; Pattern pattern = Pattern.compile(expression, Pattern

EditText setError() with icon but without Popup message

雨燕双飞 提交于 2019-12-17 04:26:27
问题 I want to to have some validation for my EditText wherein I want to show "" icon (that comes when you put editText.setError("blah blah")) but don't want the text in the popup displaying that "blah blah". Is there any way to do it? One way is to create a custom layout which will show the image icon in the EditText. But is there any better solution? 回答1: Problem solved after a lot of research and permutations- (Also thanks to @van) Create a new class that will extend EditText something like

Android: Resize only parts of view with soft keyboard on screen

試著忘記壹切 提交于 2019-12-17 04:17:24
问题 I have a view with a Edittext field on top of an ImageView. When the keyboard comes up I want the window to resize so that EditText is no longer hidden by the keyboard. In the AndroidManifest file I declared android:windowSoftInputMode="adjustResize" and the screen is resized but the issue is that I want the ImageView to not be re-sized. How can I make the ImageView unaffected? Could I inflate an additional layout with just the ImageView or will the resize still affect it? 回答1: The full

The specified child already has a parent. You must call removeView() on the child's parent first (Android)

泪湿孤枕 提交于 2019-12-17 04:14:25
问题 In my app, I have to switch between two layouts frequently. The error is happening in the layout posted below. When my layout is called the first time, there isn't occurring any error and everything's fine. When I then call a different layout (a blank one) and afterwards call my layout a second time, it gives me the following error: > FATAL EXCEPTION: main > java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. My

Change EditText hint color when using TextInputLayout

北慕城南 提交于 2019-12-17 03:56:12
问题 I am using the new TextInputLayout from the design library. I am able to get it to show and to change the color of the floating label. Unfortunately the actual EditText hint is now always white. I have tried changing the hintColor in XML, styles, and programmatically and also tried using the android.support.v7.widget.AppCompatEditText but the EditText hint always shows white. Here is my XML for my TextInputLayout and EditText <android.support.design.widget.TextInputLayout android:layout_width

android EditText - finished typing event

旧街凉风 提交于 2019-12-17 03:52:25
问题 I want to catch an event when the user finishes editing EditText. How can it be done? 回答1: When the user has finished editing, s/he will press Done or Enter ((EditText)findViewById(R.id.youredittext)).setOnEditorActionListener( new EditText.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || event != null && event.getAction() == KeyEvent.ACTION

How can I know when an EditText loses focus?

心已入冬 提交于 2019-12-17 03:31:51
问题 I need to catch when an EditText loses focus, I've searched other questions but I didn't find an answer. I used OnFocusChangeListener like this OnFocusChangeListener foco = new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { // TODO Auto-generated method stub } }; But, it doesn't work for me. 回答1: Implement onFocusChange of setOnFocusChangeListener and there's a boolean parameter for hasFocus. When this is false, you've lost focus to another control.

How to disable keypad popup when on edittext?

喜你入骨 提交于 2019-12-17 03:28:10
问题 In my app the first view of all my screens is an EditText, so every time i go to a screen the onscreen keypad pops up. how can i disable this popingup and enable it when manually clicked on the EditText???? eT = (EditText) findViewById(R.id.searchAutoCompleteTextView_feed); eT.setOnFocusChangeListener(new OnFocusChangeListener() { public void onFocusChange(View v, boolean hasFocus) { if(hasFocus){ InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);

android edittext onchange listener

风流意气都作罢 提交于 2019-12-17 03:02:50
问题 I know a little bit about TextWatcher but that fires on every character you enter. I want a listener that fires whenever the user finishes editing. Is it possible? Also in TextWatcher I get an instance of Editable but I need an instance of EditText . How do I get that? EDIT : the second question is more important. Please answer that. 回答1: First, you can see if the user finished editing the text if the EditText loses focus or if the user presses the done button (this depends on your