Friend's
I'm working upon searching in maps, here i have string in my array,when i enter characters for searching in Edit text box,i need the string have started with similar character in my result.
for example in my array i have String[] name ={"A","B","BB","Boys","Box"}
Initially i have all the array string in my result,if i suppose enter an character like b in editbox i need filter and show the charcters matches with b that is "B","BB",""Boys","Box",if suppose i enter two characters like "bo"in editbox ,i need result strings "Boys","Box"in another array.
Help me.
thanks in advance.
Consider using AutoCompleteTextView instead of simple EditText.
Related
I got this situation that i have to find * and replace with editable text for example: "HI *, What your order * some text. some more text * after". Now i need output like this Hi ____, What your order ____ some text. some more text ___ after how can i achieve this in Android please help thanks.
Firstly Spit the strings by using this post :-
How to split a string in Java
And then add edittext after each string to show output like yours.
This is Easy dude!
Just store your template in Preference, then take values from user and show it back to user with template.
For example; i Stored following in Preference:
I used specific keywords here to differentiate user's response:
Hi (name), What your order (order) some text. some more text (other)
after
where (name) is for user's name;
(order) is for user's order; and
(other) is for other info.
Now, take input from User by some Input field form, and use preference like this.
String mTemplate = "Hi (name), What your order (order) some text. some
more text (other) after";
Replace keywords with user's response like this;
mTemplate.replace("(name)","UserName_goes_here").replace("(order)","UserOrder_goes_here").replace("(other)","OtherInfo_goes_here");
Here, you'll get strings with your template. Hope this helps you.
is there a way in android to get a list of all characters from the alphabet for a specific language ?
Thanks
I don't think that's a method for that. Instead, you can view a list of alphabets and collation orders of languages here.
Then, store them in an array using this way.
char[] alphabet = "abcdefghijklmnopqrstuvwxyz".toCharArray();
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.
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've searched high and low for something that seems to be a simple task. Forgive me, I am coming to Android from other programming languages and am new to this platform and Java.
What I want to do is create a dialog pop-up where a user enters text to search for and the code would take that text and search for it within all the text in an EditText control and if it's found, highlight it.
I've done this before, for example in VB and it went something similar to this pseudo code:
grab the text from the (EditText) assign it to a string
search the length of that string (character by character) for the substring, if it's found return the position (index) of the substring within the string.
if found, start the (EditText).setSelection highlight beginning on the returned position for the length of
Does this make sense?
I just want to search a EditText for and when found, scroll to it and it'll be highlighted. Maybe there's something in Android/Java equivalent to what I need here?
Any help / pointers would be greatly appreciated
grab the text from the (EditText) assign it to a string
Try the code sample below:
EditText inputUsername = (EditText) findViewById(R.id.manageAccountInputUsername);
inputUsername.getText().toString()
^^ Replace the IDs with the IDs you are using.
After this, you have the standard string methods available. You could also use Regex for a complex search query:
http://developer.android.com/reference/java/lang/String.html
http://developer.android.com/reference/java/util/regex/package-summary.html