Note that there are some explanatory texts on larger screens.

plurals
  1. POerror on colour values
    primarykey
    data
    text
    <p>My application is calling an image from gallery and when you click on a place of the image, it voice out the colour. I'm facing a problem; I'm using a these codes to get the colour value for each place on the image. The funny thing is, it detects the colour values correctly (i.e. for red it shows r=255, g=0, b=0) but when it comes to saying the colour name (which I used 'TextToSpeech' for saying the colour name), it mostly says" The colour is black (unless you click on white, which it says Colour is white. Here is my code:</p> <pre><code> if ((Color.red(pixel) &amp; Color.blue(pixel) &amp; Color.green(pixel))&gt; 220) { if(TTSInitialized){ mTts.speak("Color is White", TextToSpeech.QUEUE_FLUSH, null); } textViewCol.setText("Color is White."); return true;} if ((Color.red(pixel) &amp; Color.blue(pixel) &amp; Color.green(pixel)) &lt; 10) { if(TTSInitialized){ mTts.speak("Color is Black", TextToSpeech.QUEUE_FLUSH, null); } textViewCol.setText("Color is Black."); return true;} if ((Color.red(pixel) &amp; Color.blue(pixel)) &gt; 120) { if(TTSInitialized){ mTts.speak("Color is Purple", TextToSpeech.QUEUE_FLUSH, null); } textViewCol.setText("Color is Purple."); return true;} if (Color.red(pixel) &gt; (Color.blue(pixel) &amp; Color.green(pixel))) { if(TTSInitialized){ mTts.speak("Color is RED", TextToSpeech.QUEUE_FLUSH, null); } textViewCol.setText("Color is Red."); return true;} </code></pre> <p>My application has Red, Green, Blue, Yellow, Purple, Cyan, Black and White. Now the question is: Is the way I'm writing the code correct? if not, what do you suggest? And Why is it always saying Black, no matter you click on red, blue or any other colour?!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload