I have one EditText
and one FrameLayout
. I made it in a way where if the user drags within the FrameLayout, the background changes the color (RGB) based on the pixel from (X,Y) coordinate and also updates the EditText with the Hex value converted from the RGB values.
Here is the Pastebin link for my entire code: http://pastebin.com/7P3QSmb4
The issue I am having is with the following code:
if (s.length() == 6) {
int color = Integer.parseInt(etHexVal.getText().toString(), 16);
int r = (color >> 16) & 0xFF;
int g = (color >> 8) & 0xFF;
int b = (color >> 0) & 0xFF;
getXY(r, g, b);
hexToRGB();
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(etHexVal.getWindowToken(), 0);
}
I want to call the function getXY(r, g, b)
only when the text of the EditText
is changed and I am not dragging within the FrameLayout
, because otherwise it would make my app lag. How can I modify my existing code?