MainActivity Need help setting the text to “You must enter a name” when the nameText is null. For some reason even when the nameText field is empty it still outputs “Hello” when it should be outputting “You must enter a name”. Answer Probably you need to check if the text of your EditText is null, not the EditText widget itself.
Tag: android-edittext
editText.getText().toString() can’t enter data
I am trying to make an app in which I can add subjects and my grades, currently, I am working on a system for adding subjects. So, I have a button, when pressed it makes an editText “field” in which you can enter the name for the subject. The problem is, when you enter some text and press ENTER, it
As a user starts to type in an EditText can it append a file extension to the end?
Problem: I’ve been trying unsuccessfully to append a file extension which follows the cursor in real-time as a user types. What I’ve tried: I’ve been trying to use the .addTextChangedListener() which I think is correct, but having an issue trying to make the idea happen. Debugging shows is continually looping and so it gives the appearance of freezing. I looked
Android: crashed when EditText Material is empty [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed last year. Improve this question Iam trying to put the code here but the site keep giving me error So here is it https://github.com/C9nc/Empty-EditText/blob/main/EditTextCheck Answer You have initialised the buttons and
Disable text wrapping in Android
I’m working on a project in Android where I have a TextView (an EditText to be exact) and a setting to enable or disable text wrapping for that view. I have searched the internet (a lot) but still haven’t found any satisfying solution. Currently I’m using a NestedScrollView for the vertical scrolling and then dynamically insert one of two partial
How can we keep the edit box by default empty, which displays the result of the spinner?
How can we keep the edit box by default empty, which displays the result of the spinner, when we click on any item of spinner then only it must show the result in the edit box else it must remain empty Answer One of the solution in your case can be as follows:
How to only let Edit Text accept Letters which are in Textview
I have an edit text however I only want letters which are in another Text view to be typeable. For example if the Text view say Hello Only H,E,L and O should be Typeable. Answer Using this code you can get it to only accept your String
Why does my android studio EditText view not display input, output, or the hint?
My EditText does not work like the videos and articles I have found. The EditText does not show what the user inputted at the time of input or when I tell the output to show there, the hint I assigned it also does not show up. Right now I have the output going to a TextView but can greatly reduce
How to underline an EditText
I am having some problems to underline an EditText in AndroidStudio. This is what I am looking for (this is just a photo, not my real text): But I do not really know any property to do that. My code …
Capitalize every word in Edit text while typing
I want to capitilze every word in edit text while typing. My XML:- Now I am using But problem is it is not working in some device. Ex LG tablet. So I decided to do this programatically. So I am using following codes. Here my app getting crash. I found the problem while debugging. Problem is the onTextChanged is not