I'm trying to learn android, I'm having trouble with user input
I've used editText to get users to enter a date and email which is all fine, then i add a hint
for these fields like so:
android:hint="#+string/DD/MM/YY"
android:hint="#+string/example#example.co.uk"
and i get multiple marker errors in the generated files :/
I don't think you can use special characters in string names. Give it a meaningful name like support_email. You can find more information here.
Related
In my application users enters mobile number's country code with '+' symbol. Right now I am checking for + symbol. If they enter '+INDIA', according to my code this is correct. But according to logic this is wrong. They needs to enter '+91'. Means they can enter only 1, 2 or 3 digit number with '+' symbol. for example '+1', '+91' or '+234'. How I can achieve this type of validation in android?
You could write your own Pattern to check the format. I could give you the example, but I think the site I linked explains it much better.
It should probably start with something like \+\d\d?\d?
You could try using Google's own implementation of Phone Numbers or this xml list.
Hope it helps !
I'm building a zip code search page for my Android app so I want to force the user to enter 5 numeric digits. I've searched everywhere and I don't see any way to for the Search Dialog. I know that text entry fields can be set to a numeric type, how do I do that for the Search Dialog?
You can use Searchable Configuration
In That you can Specify
android:inputType="inputType"
android:imeOptions="imeOptions"
For more information
http://developer.android.com/guide/topics/search/searchable-config.html
In the searchable that you have defined, you can set the input type.
For more info refer here:
http://developer.android.com/guide/topics/search/searchable-config.html
Hope this helps!
can any one know about how to add/insert emotions/smiles to text(which ever i typed in my edit text for my notes). i have little confusion about if i want to add these smiles of type .png in to edit text type of string, is it possible? and also i have to save these input into sqlite database. normally i know to store string data taken from edit text.
but along with that text i want to also add smiles symbols where ever my cursor placed and to be store in sqlite data base. and get it back to read.
so guys any ideas, most welcome!
Try to use java (i.e. android) spannable method to implement smiley (i.e.) images for that. You will surely get it, search in google for "how to add images/smiley with java spannable method in android?" you will get good idea.
Reading your question the first thing I can think of is Mapping each image to a sequence of letters, for example :) is smiley.png etc. Now your database also has these smaller representation However while reading from the database you can convert those special character sequences to appropriate image.
For simplicity in seraching those Strings You can wrap them in some less used characters i.e. [ or { or <.
I am creating an android application. The first thing I'm creating is a login activity. I am trying to limit the username edittext just to text/numbers only (no special characters). Is there a way to adjust this in the xml file?
I dont think you can limit the characters from xml. You could always use a InputFilter, but specifically android provides UsernameFilterGeneric to filter valid user names. You could also use UsernameFilterGMail
As you already use in java Regular expression.called the same class here for checking for particular field.
let me know if you want some more if you didn't know about the RE.
For allow user only can input lower case alphabet and number, how can I setup my EditText in a xml file ?
Sorry, I did not provide clear information. I just want to filter or check user's input.
AFAIK, your question is complicated to do. better get a input from user. then you can convert that string to lowercase using toLowerCase().