skydoves / Multi-ColorPicker

Android multi colorpicker for getting colors from any images by tapping on the desired color.
Apache License 2.0
124 stars 17 forks source link

setPaletteDrawable(Drawable drawable) throws a nullpointer #1

Closed BeaYeah94 closed 6 years ago

BeaYeah94 commented 6 years ago

Hi, when I make a photo with the camera and try to set it as the palette image it thorws a nullpointer exception. I have checked and neither of the object are null so I think is a library Issue. Here is my code:

Bitmap bmp = MediaStore.Images.Media.getBitmap(getContext().getContentResolver(), imageUri); ImageView im = new ImageView(getContext()); im.setImageBitmap(bmp); photoCompare.setPaletteDrawable(im.getDrawable());

And the error:

Caused by: java.lang.NullPointerException at android.view.ViewGroup.addView(ViewGroup.java:3353) at android.view.ViewGroup.addView(ViewGroup.java:3336) at com.skydoves.multicolorpicker.MultiColorPickerView.setPaletteDrawable(MultiColorPickerView.java:359) at com.beayeah.match.match.JudgeFragment.onActivityResult(JudgeFragment.java:269) at android.support.v4.app.FragmentActivity.onActivityResult(FragmentActivity.java:156) at android.app.Activity.dispatchActivityResult(Activity.java:5423) at android.app.ActivityThread.deliverResults(ActivityThread.java:3359) at android.app.ActivityThread.handleSendResult(ActivityThread.java:3406)  at android.app.ActivityThread.access$1300(ActivityThread.java:135)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1244)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:136)  at android.app.ActivityThread.main(ActivityThread.java:5019)  at java.lang.reflect.Method.invokeNative(Native Method)  at java.lang.reflect.Method.invoke(Method.java:515)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)  at dalvik.system.NativeStart.main(Native Method) 

skydoves commented 6 years ago

It's fixed at v.1.0.6. Thank you for your issue!