I have this SearchMenuActivity that has a bunch of options the user can select. Two of the options fires an intent to a ListView where the user can select a value and then it reports back to the SearchMenuActivity. I also have another option like this except it allows the user to select multiply options. The problem that I am having is choosing a UI component that will launch the ListActivity and hold the results when it reports back via onActivityResult. I have come up with a couple solutions here they are ...
Solution 1
Use a button which default text is "Choose item a". This will launch the ListView and then when the user selects an item the text of the button will become the selection.
Solution 2
Use a spinner. The problem with this is that spinners do not support multi selection items. It would also complicate things because the items in the list view are being pulled from a server backend and displaying a loading message on top of the spinner would look ugly.
Solution 3
Have a clickable textview which default text is "Click here to select item". This will launch the ListView and then when the user selects an item the text of the textview will become the selection.
Right now I am implemented solution 3. The "Click here to select item" seems intrusive. Anyone have any ideas as to what is the best method to solve this problem?
Option 3 is the best
However it is not very nice for changing his choice. I think you must add a small icon to the right of the TextView that allows the user to re-select.
Related
I'm playing around with Android spinners. I'm not 100% sure if I can get the behavior I want using a spinner, but it's the most obvious choice that comes to mind.
I need something of a dropdown view, the title of which says "x of y selected".
The options in the dropdown would look like:
-All
-None
-Special items only
On clicking one of the dropdown items, the title is reconfigured such that 'x' changes.
It would be ideal to use a spinner, but somehow, it seems that android puts in the first value of the spinner to always be the first values in the list of strings you pass it, and I clearly don't want the title item to be shown in the dropdown list for my case.
Another approach that I came across was to perhaps use a button with a popup with these items in the popup.
Would that be a better approach, or can I actually achieve the behavior using a spinner, or is there another view that would better serve my purpose?
I'm going to redirect to this post, after a lot of searching I found what I was looking for:
How to hide one item in an Android Spinner
The answer by Aebsubis, and make sure to set the text view height to 0. I'll update this answer with more code, once I'm done with tweaking it for my purposes.
In my application I currently have an xml layout that is re-used to enter information 6 times (these are turns in a game). This works fine. At the end of the round I present a screen that has a summary of each turn. I want to implement a button beside each turn to "edit" that turn. There are 3 possible things that can be edited. Ideally an alert dialog or something like a "popup" would be idea for this.
Would I be best off to have 3 buttons per "turn" for editing or is there a way to do this with a popup?
Thanks for your input on this matter.
You could list each turn and it's information with a single edit button next to each. When the edit button is pressed, create a new activity (intent) that prompts for all three pieces of data.
You have several options (and probably more I'm not thinking about). If these are in a ListView (or even if not) you could use a ContextMenu. You could have options in here to change the selected item or others. This would show a popup when the user long clicks the item
A PopupMenu can give you a similar effect that can pop up a list of options when the user clicks on a Button. Note that this requires API >= 11
You also could use an AlertDialog, as you mentioned. But just from what little I know about what you are trying to do I'm not sure this is what you would want.
Again, I don't know enough details about what you have or want but I would say that one of the first two options would suit you best. As far as one Button or multiple Buttons, that depends on the layout that will work best for your app, I suppose. You certainly could have one "Edit" Button which uses something like a PopupMenu and allows the user to choose what to edit. I hope this helped a little.
I'm developing an application and I am facing a problem using ExpandableListView. What I'm trying to do is, in GroupHeader, not only show the group name, but also an spinner with options. That's because I want to show the football second division games in the list but, also, give the option to choose the round, in case the user wants to check older/future games. SO far I have that
As you can see both, title and spinner, shows. Also you can see the arrow on the right which is supposed to expand the list. Problem is that, if I click, only spinner opens, group expand button doesn't. So, here is my question, how can I make both of them work depending on where you click (one or another)??? Is that possible?
Also I must say that if I only place the TextView with the group name works perfect. If I only place the spinner, the problem persists. So I'm guessing that's a focus problem.
Btw: grey areas are the layout backgrounds, so no, they are not hiding behind the button.
I found the solution, I just neede to add this line android:descendantFocusability="blocksDescendants" to the Main Layout of the xml where I define the GroupHeader elements.
I am working on a game project.
I have 4 buttons on my screen. User has to select one of the 4. If user selects the correct one, it works fine. but if user selects incorrect one, I want to highlight the correct answer even though user didnt clicked it.
I have presentation due tomorrow. Can anybody point me to some example source or explain it here, as to how can I accomplish it.
You can set the correct buttons background color or image while clicking other buttons
Whenever user clicks on the incorrect button simply call :
correctButton.setPressed(true)
This will highlight the correct button as per your requirement.
you can do one thing..
Call Button.requestFocus() method to get the focus.
Create a custom selector for you Button's background. there
< item android:state_focused="true" android:drawable="#color/your_color" />
I have a spinner item, with three elements, say
i) A - one
ii) B - two
iii) C - three.
When the user presses the spinner, the drop down box displays these
elements, but when one of them is selected the only text that should be displayed
is the character, say A (like an index).
I can't seem to find anything useful except using "android:promt" to display a
legend indicating what each character/code stands for but this looks unprofessional
and confusing to the user.
Is there anyway I can do this using android?
If anyone can help me, thanks in advance :)