Reputation: 1026
Eclipse gets me very strange error: The method getColor() is undefined for the type ColorDrawable
android.graphics.drawable.ColorDrawable dd =
new android.graphics.drawable.ColorDrawable();
dd.getColor();
I've no idea how to fix it. All other methods are exist. wtf?
Upvotes: 3
Views: 2032
Reputation: 2794
Why not draw the Drawable into a tiny offscreen Bitmap, and call getPixel to retrieve the colour you drew?
Upvotes: 0
Reputation: 471
What is your target API level? ColorDrawable.getColor() is introduced in API level 11, so if you're targeting a lower API level you won't have access to that function.
Upvotes: 3