-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
color/touch location is incorrect when compiled for SdkVersion 28 and above #9
Comments
this seems to fix it and produces the correct pixel color https://stackoverflow.com/a/46377322 @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final View targetView = findViewById(R.id.colorSample);
targetView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent ev) {
// TODO Auto-generated method stub
ImageView img = (ImageView) v;
final int evX = (int) ev.getX();
final int evY = (int) ev.getY();
img.setDrawingCacheEnabled(true);
Bitmap imgbmp = Bitmap.createBitmap(img.getDrawingCache());
img.setDrawingCacheEnabled(false);
try {
int pxl = imgbmp.getPixel(evX, evY);
findViewById(R.id.colorSlot).setBackgroundColor(pxl);
}catch (Exception ignore){
}
imgbmp.recycle();
return true;
}
});
// setUp();
} |
mgood7123
added a commit
to mgood7123/profile-image-extractor
that referenced
this issue
Apr 5, 2020
no longer uses EyeDropper refer to Madrapps/EyeDropper#9
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No description provided.
The text was updated successfully, but these errors were encountered: