Hello,
I am attempting to disable any button after it has been clicked by the user.
Not sure on how to pass the button id to the onButtonClicked method.
Is it possible to get the current focus using a built in method within onButtonClicked() ?
Any ideas?
In my list_item_sound.xml file I have…
<Button
android:layout_width="75dp"
android:layout_height="75dp"
android:clickable="true"
android:onClick="@{() -> viewModel.onButtonClicked(????)}"
android:text="@{viewModel.title}"
tools:text="Sound name"/>
In my SoundViewModel.java file I have…
public void onButtonClicked(View v) {
butnum = mSound.getSoundId();
v.findViewById(butnum).setClickable(false);
mGame.play(mSound);
}