Android: EditTextPreference dialog showing value from previous invocation - android

In my application I have a list of accounts in the settings screen. If you click on an account you go to a screen showing the account details. The account name is an EditTextPreference, if you click on it Android shows a dialog enabling you to change the name of the account.
The very first time this dialog is shown there is no value specified. The user enters the new name for the account and clicks OK and the account name is updated.
The problem is when I then view a different accounts details and click on its name to edit it, the dialog is showing the text from my previous rename. Why is this not showing no value or the current name of the account? Why is it reusing a value from a different account?

The problem caused because you use one dialog for all accounts.
You should clear Edit text after press OK, also you should use SharedPreference to store the the details of each account.

The problem was caused because shared preference name is "global". So when you open the preference for one account you are getting the value that was last set.
The fix we have done is in our setting's screen's onCreate() we reset the account name preference to the name of the account the setting screen is for. Then when the edit name dialog is opened it has the correct account name.

Related

How to make user submit information in a particular order?

I'm trying to build a user input form in Android by displaying the following input views on an activity screen:
Spinner (Get a location from pre-filled options)
EditText (Get exact address)
Spinner (Get 2nd location from pre-filled options)
EditText (Get exact address)
Date
Time
Now, I want to allow the user to fill the above fields only in the particular order mentioned above, eg. user should not be able to see options in 2nd spinner unless she selects one from the 1st spinner, or user should not be able to fill EditText fields before selecting option from spinners...
How can we ensure this?

Registered user check for lowercase or uppercase

I want to know how to check the existing users for either upper or lowercase when a new user is signing up. At present for example the followig two users can be registered
tom and Tom, both of these are considered as two separate users, so if this happens I want to sound off to the user that the username already exists. Where in code exactly can I do this?
You can create a textwatcher for the edittext where user enters loginname and when focus changes from the edittext get the string in there using getText and pass this to an api which will check the username with db to check for similarity and will return a status false if similar user exits and you can show a red underline or red hidden badge to side of the edittext on the basis of this result to notify the user that such a username already exists.

Android edittext : show swim out prompt with last logged in email

I have email edittext field and need to show last successful logged in values of email, if first characters of them are equal.
I know, that successful logged in values I can store in the sharedPreferences. But how can I show it and when user clicks on it, it have to be setted in the login EditText.
How can I do it?
Use an auto complete EditText as login field like in this page http://android.foxykeep.com/dev/how-to-add-autocompletion-to-an-edittext

Android App , add a favorite quote functionality

I have an android app which displays quotes and have navigation to go to next quote and so on. would like to add "Save Quote As favourite" based on users selection of particular quote.
Once user saves Fav quotes and wants to see those quotes only, app should show those quotes.
Currently app reads the quotes from XML file. Let me know if any more information is required to understand the problem.
I would provide every quote with an ID (int). Whenever the user selects a quote to be a favourite, that ID is saved to a Set of integers. Later on if user decides to show favourites, you fetch all quotes with your IDs from the Set and show them in a appropriate view, for example a ListView
If you have a Quote class or something like that, you might as well put them in a collection whenever user decide his favourites, and show them in a ListView with a custom adapter.

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

Categories

Resources