Toggle button with more states that two

by Duskox » Fri, 11 Mar 2011 01:51:50 GMT

Sponsored Links
 I am trying to find if there is a possibility to use togglebutton in
such a way to have more states that two? So I want a single button to
change appearance (background image) depending on what state it is in.
So if I have states 1, 2, 3, 4, 5 and off to be able to change between
all those states and display a new image for every state.



Re: Toggle button with more states that two

by Justin Anderson » Fri, 11 Mar 2011 02:01:08 GMT

 I don't think so, but it shouldn't be too hard to just subclass the Button
class and implement this behavior yourself.

Justin Anderson
MagouyaWare Developer 


Sponsored Links

Re: Toggle button with more states that two

by mort » Fri, 11 Mar 2011 14:58:18 GMT

 I think this would also break the user experience. Better use a
spinner. You can show different "foreground" images if you use proper
layouts and adapter.
For both button and spinner you could simply set a new button
background when the item has changed, i.e. in the OnClick- or
However, I don't think background images (at least if they still
should look like common button surfaces) are quite intuitive, esp. not
with so many states.
Depending on your screen layout, it might also be a good idea to
simply show an icon and/or text with prev./next state arrow buttons or
tabs. I for one wouldn't like to press a button 5 times to get to the
previous state again...


Re: Toggle button with more states that two

by Duskox » Mon, 14 Mar 2011 21:54:24 GMT

 Thanks for your suggestions. What I want to do is a button that will
have an off state and then a repeat all state and repeat single state.
Like in any mp3 player where you can loop the whole playlist, single
song or no loop.

I'll check spinner out and then if that is not what I want go to
create a subclass.



Other Threads

1. modifying init.rc file

Hello All,
I modified the init.rc file to import a new configuration file by
adding the following lines in the init.rc file

import /data/myconfig/conf/init.rc
trigger system

And the file at /data/myconfig/conf/init.rc contains

on system
   export TRIAL_EXPORT /trial/export/to/be/replaced

The problem is that I cannot get the new export (TRIAL_EXPORT)to
working. When I issue the command echo $TRIAL_EXPORT on the adb shell
I do not get anything.

Can somebody point out what is wrong in here?


2. auto add contacts.

can someone tell me how to get contacts or the address book to stop
syncing email address. it annoys me to send an email to a address not
in phone book and only to later see it as a contact.  how do i stop
this? i dont want to add more contacts


3. Activity/ListActivity trying to trigger setOnClickListener and not the onListItemClick

4. How to style a Button to look like a Spinner?

5. audio eac

6. How to get webview's content into a bitmap?

7. SMS PDU code