0

How can I send a color value to my BlueTooth class? For instance, in the code below, how could I send the hex value of a text1 color attribute? I'm using

  1. Github.com/harrygoodwin/arduino-android-sensor
  2. Github.com/trevorshannon/arduinocolor

Code:

private void updateTextAreas(int col) {
    int[] colBits = {Color.red(col),Color.green(col),Color.blue(col)};
    //set the text & color background
    text1.setBackgroundColor(col);

    if (isDarkColor(colBits)) {
        text1.setTextColor(Color.WHITE); }
    else {
        text1.setTextColor(Color.BLACK); }
 }
Prune
  • 76,765
  • 14
  • 60
  • 81
MPM
  • 11
  • 2
  • Please explain better. – lionscribe Sep 19 '16 at 04:30
  • i want to create one Bluetooth class and send color value from colorpicker activity to bluetooth class – MPM Sep 19 '16 at 04:41
  • Are you asking how to do Bluetooth communication, or are you asking in what format to send it. If the latter, just send it as an integer. – lionscribe Sep 19 '16 at 04:44
  • yes,i want to send HEX value to Bluetooth – MPM Sep 19 '16 at 05:25
  • private void updateTextAreas(int col) { int[] colBits = {Color.red(col),Color.green(col),Color.blue(col)}; //set the text & color background text1.setBackgroundColor(col); if (isDarkColor(colBits)) { text1.setTextColor(Color.WHITE); } else { text1.setTextColor(Color.BLACK); } } – MPM Sep 19 '16 at 05:30
  • how to send text1 value to bluetooth communication – MPM Sep 19 '16 at 05:31
  • Hi Prakash M. M, I think you are asking for passing values of color from one activity to another. If you want this, you can use bundle for this functionality. You can refer this link: http://stackoverflow.com/questions/4999991/what-is-a-bundle-in-an-android-application – Kuldeep Kulkarni Sep 19 '16 at 06:40
  • 1.Github.com/harrygoodwin/arduino-android-sensor 2.Github.com/trevorshannon/arduinocolor – MPM Sep 19 '16 at 06:57
  • please check the code and tell me solution for send color value i.e #fff00 to bluetooth – MPM Sep 19 '16 at 07:00
  • Cleaned up expression; edited clarifications into question. – Prune Sep 21 '16 at 19:08

0 Answers0