Questions tagged [android-togglebutton]

A toggle button allows the user to change a setting between two states.

A toggle button allows the user to change a setting between two states. It displays checked/unchecked states as a button with a "light" indicator and by default accompanied with the text "ON" or "OFF".

For more information, see the Toggle Buttons guide.

199 questions
0
votes
0 answers

Setting the background of a Toggle Button to an XML but in the Activity Java

In my Activity A, I have 8 toggle buttons that the background of them is set within the layout xml to an xml file to change the pictures on change state. After choosing 4 of them, the image strings are saved to a SQLite database. In my Activity B, I…
johnnysheps
  • 37
  • 1
  • 1
  • 7
0
votes
1 answer

Get state of Toggle Button in different class android

I have used ToggleButton in my MAINACTIVITY.java. When it is on am fetching the current location from another class GPSLOCATION.java and updating to server.
Munchoo
  • 313
  • 1
  • 7
  • 22
0
votes
1 answer

Remove custom toggle button text space android

Why is my toggle button taking the wrong width and have the space of text? I want this toggle button to be exactly the same width as the other buttons Here is the code:
awaistoor
  • 786
  • 2
  • 11
  • 36
0
votes
1 answer

Why ,toggleButton is not performing its task when it is set to false?

I have some toggle buttons in my app, I am setting the state of toggle buttons as true at the time of it's first run.The problem is, when i am trying to set false (button turning off) it shows that it is changed its state as false but the action to…
0
votes
0 answers

List adapter unchecking my toggle button when I scroll. Tried multiple solutions from here but no luck

my adapter (the style of which has been working for the rest of my app) is now giving me issues. This is the first list that has a toggle-able button. Each listItem has a toggleButton, which when I toggle, scroll down and then back up, it becomes…
0
votes
1 answer

play and stop or pause mp3

ok my toggle button is working fine , but my mp3 not got started after when its stopped. here is my code please do tell me proper way to stop and start again mp3 sound. here is my code and debug logs. public void toggleclick(View v) throws…
Bibi Tahira
  • 1,082
  • 5
  • 15
  • 39
0
votes
1 answer

Customized switch toggle button

I wan't to customized my switch in android. The problem is that the default button overlay my own drawable. What have i done: create my own graphics (2 graphics) create a xml in the drawable folder, that's look like this:
Manu Zi
  • 2,300
  • 6
  • 33
  • 67
0
votes
0 answers

Toggle button not working as per conditions

I have a toggle button to play and stop .mp3 , music got stop but when I unchecked the button it wont start mp3 again. Here is my code: tg.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { …
Bibi Tahira
  • 1,082
  • 5
  • 15
  • 39
0
votes
2 answers

Toggle Button state loading issue

I am using Toggle button and now i have to control on state of it when switching between activities and i am able to control the state as well, but even toggle state is off it still performing toggle on tasks boolean tg1pref; public…
Sun
  • 6,768
  • 25
  • 76
  • 131
0
votes
1 answer

Unable to call activity using Toggle Status

I am using Toggle button to call other activity, and using code which we use with normal android button to call another activity like this: toggleButton.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override …
Sun
  • 6,768
  • 25
  • 76
  • 131
0
votes
2 answers

Toggle Switch inside custom listview makes listview non-clickable

I am working on Android application in which I am making a custom listview in which I have put some textviews and one switch. After putting toggle switch it makes listview non clickable. I have also put android:focusable="false" in my XML, but it is…
Usman Khan
  • 3,739
  • 6
  • 41
  • 89
0
votes
2 answers

Stop ToggleButton text Capitalization at API 10

I want to stop my ToggleButton's text from being capitalized at API 10. I know I can use setAllCap(false) to stop the Cap lock of Toggle Button, but how can I do the same at API level 10, since setAllCap(false) is only supported at API level 14,…
CrazyGreenHand
  • 193
  • 1
  • 9
  • 19
0
votes
2 answers

Implementing (switch\toggle button) depending on API level

My application will run on api level 9 devices or higher. Now i have a toggle_button on one of the layouts. I want to change this toggle button to switcher if the device is apilevel 14 or higher. How can i implement this? Sorry for my english.
Valentin Baryshev
  • 2,195
  • 3
  • 15
  • 24
0
votes
1 answer

ListView and ToggleButton

I have looked at all the other simple questions but couldn't find the answer I was looking for. I have a ListView and each list item contains a toggle button. I have two questions: When a toggle button on one of list items is pressed when…
RnP
  • 33
  • 3
0
votes
2 answers

Toggle Button not doing anything when clicked

I'm trying to use a ToggleButton inside my Android code, but it seems that it does nothing within it and I don't know what I'm doing wrong. Does anyone know what I'm doing wrong? Here it is the code: public class StartActivity extends…
colibriii
  • 79
  • 1
  • 1
  • 13