Change background of EditText’s error message

I would suggest to use @Codeversed solution, but if it doesn’t fit for you for some reason you can use my custom EditText implementation. Usual EditText representation: EditText with error: In few words: I’ve created custom xml state for error display. See related code below: InputEditText.java: import android.annotation.TargetApi; import android.content.Context; import android.graphics.drawable.Drawable; import android.os.Build; import … Read more

Android adjustpan not working after the first time

This may seem a bit silly but I ran into this problem when I set the property gravity of my EditText to either ‘center_horizontal’ or ‘center’. The same problem occurs when using textAlignment ‘center’. Remove it and you won’t run into the problem of the keyboard hiding the EditText the second time (and subsequent ones) … Read more

Stop ScrollView from auto-scrolling to an EditText

After struggling with that problem for quite some time, I’ve found a solution that seems to work without being too ugly. First, make sure that whatever ViewGroup (directly) contains your EditText has descendantFocusability set to “Before Descendants,” focusable set to “true” and focusableInTouchMode set to “true.” This will not be the ScrollView itself, but the … Read more

Android Word-Wrap EditText text

Besides finding the source of the issue, I found the solution. If android:inputType is used, then textMultiLine must be used to enable multi-line support. Also, using inputType supersedes the code android:singleLine=”false”. If using inputType, then, to reiterate, textMultiLine must be used or the EditText object will only consist of one line, without word-wrapping. Edit: Thank … Read more

how to validate a URL / website name in EditText in Android?

Short answer Use WEB_URL pattern in Patterns Class Patterns.WEB_URL.matcher(potentialUrl).matches() It will return True if URL is valid and false if URL is invalid. Long answer As of Android API level 8 there is a WEB_URL pattern. Quoting the source, it “match[es] most part of RFC 3987”. If you target a lower API level you could … Read more

How to highlight Multiple words in EditText?

I have wrote a simple method that allow you pass TextView (or child classes Button, Edittext etc.). 1. If you want to highlight a text like in find word in paragraph. You can use below method like. setHighLightedText(yourTextView_Edittext_Button, “a”); Which gives you result like this. /** * use this method to highlight a text in … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)