how to combine edit text with spinner - android

I am writing simple login activity.
I have login edit text and password edit text.
I am kepping login and pasword via sharedpreferences.
I want to make login field to rember previous logins (eg "aaa" and "aab") so when you type in edit text it give you some options and you can choose them to outo complite it.
How it can be done?

You should use AutoCompleteTextView instead of simple EditText
check dev link http://developer.android.com/reference/android/widget/AutoCompleteTextView.html
also check this link for detail http://www.javatpoint.com/android-autocompletetextview-example

You can use AutoCompleteTextView for the login field, and use a suitable adapter to display the values. If you are remembering the previous login IDs, then, you can store them in SQLite DB and use CursorAdapter to populate the auto complete text view.

Related

Android - how to create custom word dictionary for only my application?

I have successfully added a word to Android's predefined user dictionary, but i want to create a custom dictionary which can only be accessed by my application.
For example: When i type "lol", the suggestions show me "laugh out loud" but when I want another meaning of "lol" then I can manually add another meaning of "lol" (eg, "xxxxxx" - so the next time the user writes "lol" in an EditText, the suggestions will show him "xxxxxx").
No other application should have access my dictionary data.
I have worked with spell checker class but it gives me only correct word and I can't my own word meanings.
Please give me some suggestions or links.
There is an Androids inbuilt class UserDictionary so that you can add your spells programmatically into that, Here is a link you can go through with , and which may relates to your problem .(In this solution nidhi has manged programmatically to retrieve data back)
Add word to user dictionary and retrieve them back from dictionary
In addition you can go through following links to :
http://developer.android.com/reference/android/provider/UserDictionary.html
http://developer.android.com/reference/android/provider/UserDictionary.Words.html
Moreover if you want a custom personal dictionary then manually you have to store words and retrieve them back .
Hope that helps !!!

How to do list box in android

am trying to do .when i click a button opens another activity and shows list box. In that list box display a list of values of particular column of table. that is we have to retrieve from
sqlite database.
how to do??
like this:
http://www.google.co.in/imgres?imgurl=http%3A%2F%2Fwww.tutorialspoint.com%2Fimages%2Ftk-combobox.jpg&imgrefurl=http%3A%2F%2Fwww.tutorialspoint.com%2Fruby%2Fruby_tk_combobox.htm&docid=SVhMpjb5FMImxM&tbnid=l4yuDUmNF-lm5M&w=220&h=242&ei=HBNRUay8B8OUrgeA94CYDw&ved=0CAcQxiAwBQ&iact=ricl
Fetch the results from database
Put it in a adapter
Populate android spinner with the adapter
Use the link below for reference
http://developer.android.com/guide/topics/ui/controls/spinner.html
Answer is to big so don't possible entire code i am just giving you guide line.
Step:
You have to fetch all record in database and store into Collection class variable.
Set those variable to adapter.
You have to used onClick and get information which is require.
You can refer this tutorial may be helpful.If this is helpful then accept answer.

ideal database field for calling data to

Hello people can someone help.
I have designed a dialog in which I would like to have a field box or some sort that when the dialog is called the TYPE & AMOUNT (link) box's will display the data from database on each item. So for this dialog I have made. The user will click drinks button on the activity before the dialog. And the data will fill theses field boxes once called.
My question is what can I use for this data box caller.
You can use TextView or EditText widget (depending on if you want user to just see or edit the data respectively) and you can pull data from SQLite Database.

I have an app where I am asking for input a username and password.Right now. It has been changed. Once the user clicks on login in the login menu

I have an app where I am asking for input a username and password.
Right now. It has been changed. Once the user clicks on login in the login menu.
The username should be refilled with a known username and we only ask the user to input password to improve user experience.
Could we use the exist username edit text in my layout file or i have to change to label instead of edit text? I know i can use setText() to populate the username edit text field.
The question is not about saving username (using sharedpreference). what is the best way to
change my code to use ( either edit box or label ).
Please let me know what is the best case to avoid too much change.
Use SharedPreferences to store the usreanme and then everytime you load the layout in your code, check your sharedPreferences and fill the username edittext using setText

autofill password on edittext

i'm a little blocked with this thing. I want to fill one edittext's password when the user type its login. I have the login and password on one database sqlite. I have read on android developers that it can be done with a AutocompleTextView, but i only want to fill the edittext with its password, nothing else. It Anyone knows how can i do this?¿
Cheers
when you create your activity with the EditText get a handle on it and call setText() with the password from your database.

Categories

Resources