Questions tagged [android-button]

questions about the android.widget.Button element. This element can be used on activities.

On Android, buttons can be generated programmatically in Java code or by using xml layouts. Usually a listener(OnClickListener) is set on the Button to receive an event when the user touches the Button. The listener can be set in code or by using the android:onClick attribute in the xml layout, setting it to point to a method written in the Activity class.

Initial help

2399 questions
0
votes
4 answers

Building a variable upon buttons to trigger listeners

I am breaking my head dealing with variables types in my app. I try in a loop to increase a var and pass it to a listener, according to the name of the buttons defined in my XML layout. I would like to start from "jeton1" to "jeton2","jeton3"....,…
alhambra60
  • 11
  • 3
0
votes
1 answer

How to create a RecyclerView of Buttons

I am creating an AlertDialog custom class, called ActionDialog, which will contains a RecyclerView containing Buttons. I have a List of Button that I populate in the custom class ActionDialog (for now i just populate with useless Button just to try…
Fyruz
  • 75
  • 1
  • 20
0
votes
4 answers

How to synchronize two buttons in two seperate fragments

Is it possible for two (switch) buttons to have synchronized behavior between fragments? i.e: When button A is switched on in fragment A, I want button B's appearance in fragment B to also appear switched on. How would I do that? The end goal is to…
Bread
  • 71
  • 1
  • 13
0
votes
1 answer

Need an android button to execute with an intentionally blank EditText box

I have a simple screen with two EditText Boxes and 1 button. I want users to be able to enter various integers into the boxes and the program will perform different operations based on the specific number entered into the box. I'm trying to have…
0
votes
1 answer

Custom Button - Why does a StateListDrawable with png images get rid of the default button StateListAnimator, whereas xml shapes keep it?

I am playing around with custom Buttons by defining different states in a StateListDrawable and setting it as the background on a Button. I realized that when these different states contain png images as their background, the default AppCompatButton…
0
votes
1 answer

My Android Button needs to be tapped twice to work

I recently got a problem that my android button needs to be tapped two times to work. I already did a lot of researche but none of those solutions helped. Here is my code: This is how I define the button:
0
votes
1 answer
0
votes
0 answers

onClick callback not getting called from a button inside a recyclerView

I am creating a RecyclerView on a fragment, and there is a button in one of the viewHolder(cell). But on the emulator, nothing happened after I clicked on that button. I set break points in the code for onClickListener, it doesn't even jump into the…
Jacky.S
  • 364
  • 5
  • 17
0
votes
1 answer

dynamically changing button theme

I have two styles for my button: