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?
Related
in android stuido I would like to code an activity, where the user can input numbers. For, example he types the number to the textfield, click 'OK' button, then the textfield gets clear, he types the second number, than the third, and after they give the third number the program goes to another activity and sayst thanks for the free number. I would like to save the three numbers for further use and have them in an ascending order. How should I do it?
I agree with Andrii, this is a very vague and general question. To get you pointed in the right direction though, you would want a layout with an number based-editText widget (for the user input). I would then add the button, and then implement OnClickListener for the button so that everytime the button is pressed, it calls a method you will define that will store the value in an array or list (which can be sorted), along with some kind of tracker to keep track of how many numbers have been entered - then clearing the editText field so that another number can be input; on the third number, the method calls the activity via intent or some other way saying "thanks for the free number".
This is all general and it is going to take quite a bit of work and API Guide/DeveloperDocs searching on the Android web site.
I'm making a very simple launcher for Android. I'm having trouble getting some speed dial buttons to work.
The idea is that when the user presses the speed dial buttons for the first time, they'll be prompted to enter a phone number with a popup window (dialog? I think?). That number will then be assigned to that button, which will then call the assigned number when the button is next pressed. It's not great if they want to reassign a number, but this is just something rough that i'd like to get out of the way. I'm thinking of creating an int to reflect the state of the button (0 = no number assigned, 1 = number is assigned), and using if statements to either bring up the window or call the number.
I don't know how to bring up such a window (although I do know I can bring up a dial pad using (android:inputType="phone")), as well as how to pass the number that the user inputted to an int/long. I'm thinking I can assign the value to an int, although that might not be the most optimal data type. I have a rough idea on how to dial a number once it's given.
What should I do? I'm quite new to programming, so i'm having trouble with this.
may be this could help.
have a long click listener to the buttons.
on long click event, show a dialog widow which accepts the number.
store it in a persistent memory, either db, files or pref utils by android.
in on click button, have a logic to retrieve the stored content and update the views accordingly.
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.
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.
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.