fixed off by one error and added debugging.
This commit is contained in:
parent
3b4eba6605
commit
de2e74149e
1 changed files with 3 additions and 2 deletions
|
|
@ -13,6 +13,7 @@ import android.view.MenuItem
|
||||||
import android.widget.Button
|
import android.widget.Button
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import com.example.prootcontrol.databinding.ActivityMainBinding
|
import com.example.prootcontrol.databinding.ActivityMainBinding
|
||||||
|
import android.util.Log
|
||||||
|
|
||||||
class MainActivity : AppCompatActivity() {
|
class MainActivity : AppCompatActivity() {
|
||||||
|
|
||||||
|
|
@ -49,7 +50,7 @@ class MainActivity : AppCompatActivity() {
|
||||||
|
|
||||||
buttons.forEachIndexed { index, btn ->
|
buttons.forEachIndexed { index, btn ->
|
||||||
btn.setOnClickListener {
|
btn.setOnClickListener {
|
||||||
setSelectedButton(btn, index)
|
setSelectedButton(btn, index+1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -66,7 +67,7 @@ class MainActivity : AppCompatActivity() {
|
||||||
|
|
||||||
|
|
||||||
mqttHelper.sendMessage("Butn_000"+number+"_0001")
|
mqttHelper.sendMessage("Butn_000"+number+"_0001")
|
||||||
|
Log.d("TAG", "Butn_000"+number+"_0001")
|
||||||
|
|
||||||
button.isSelected = true
|
button.isSelected = true
|
||||||
button.setBackgroundResource(R.drawable.button_selected)
|
button.setBackgroundResource(R.drawable.button_selected)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue