Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello freinds,

I am building an android app, in which i am aiming to give user suggestions of my application

text whenever he uses editText to enter something in any application.

Is this possible? If my app runs as a service, or is there some other way.

Thanks for your help in advance!!
Posted
Updated 16-Mar-13 10:55am
v3

1 solution

Sure. What you need is called AutoComplete text. This is text suggested to the user based on the first few letters typed, which takes into consideration possible suggestions you include, or previous text typed.

Java
public class CountriesActivity extends Activity {
     protected void onCreate(Bundle icicle) {
         super.onCreate(icicle);
         setContentView(R.layout.countries);

         ArrayAdapter<string> adapter = new ArrayAdapter<string>(this,
                 android.R.layout.simple_dropdown_item_1line, COUNTRIES);
         AutoCompleteTextView textView = (AutoCompleteTextView)
                 findViewById(R.id.countries_list);
         textView.setAdapter(adapter);
     }

     private static final String[] COUNTRIES = new String[] {
         "option1", "option2", "bla bla bla", "etc.", "chose me"
     };
 }</string></string>
 
Share this answer
 
Comments
Michael Haephrati 16-Mar-13 17:02pm    
If you liked my answer please "accept"it and vote for it :) Now as for your questions, if you want to merge user inputs for all users, you can do it (and it is a great idea!) but it will not take place automatically. You need to do it programatically. So your application doesn't necessary have to run online this time. Just write a routine that periodically update the server, and the server will update all users.
Monster Maker 16-Mar-13 17:08pm    
Yep i do like your answer? :)))
Thanks for appraisal, if app went gr8,, ur name will be mentioned their too... :)!!

LL b back soon!
Michael Haephrati 16-Mar-13 17:10pm    
Let's keep in touch. My email is : haephrati@gmail.com. Send me a private email and we can continue from here.
Monster Maker 16-Mar-13 17:12pm    
code project worked for me.. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900