B4J Code Snippet Leds and switches

Leds and switches
 

Attachments

  • leds.zip
    16 KB · Views: 355
  • led.jpg
    led.jpg
    46.9 KB · Views: 532

stevel05

Expert
Licensed User
Longtime User
Very nice :) Thanks for sharing
 

Beja

Expert
Licensed User
Longtime User
Hi Bene,
Please pardon my ignorance, but do you think a three 2-dimensional arrays that change color with the click of a corresponding button image can do the same job?
 

BeneBarros

Active Member
Licensed User
Longtime User
Hi Bene,
Please pardon my ignorance, but do you think a three 2-dimensional arrays that change color with the click of a corresponding button image can do the same job?
Hello Beja
I did not quite understand your question.
Forgive my English, it's very weak.
 

Beja

Expert
Licensed User
Longtime User
no it's my explanation that was not clear..
I have 3 buttons array (0 to 2)
I have 3 images (0.png, 1.png and 2.png)
I have 3 more images (0.jpg, 1.jpg and 2.jpg)
I have 3 imageViews (imageView(0), imageView(1) and imageView(2)

Then just swap the images that correspond to the clicked button index
 

BeneBarros

Active Member
Licensed User
Longtime User
no it's my explanation that was not clear..
I have 3 buttons array (0 to 2)
I have 3 images (0.png, 1.png and 2.png)
I have 3 more images (0.jpg, 1.jpg and 2.jpg)
I have 3 imageViews (imageView(0), imageView(1) and imageView(2)

Then just swap the images that correspond to the clicked button index
Got it.
It would work the same way. But if you use four buttons with different colors, you would have to have more images loaded.
I do not know what would be best.
 

Beja

Expert
Licensed User
Longtime User
yeah, you are right..
My thinking is always to simplify things.. even in case of four or more LEDs I would be thinking about using shapes with color properties for the LEDs,
it will then be a trade-off between code reduction and realistic objects.
 
Top