-1

I used this library https://github.com/liuguangqiang/IPicker

This is my code:

public void onClick(View view) {
        switch (view.getId()) {
            case R.id.ll_profile_pic_container:
                IPicker.open(getApplicationContext(), selectPictures);
                return;
            ...
    }

This is the error I receive when in activity com.liuguangqiang.ipicker.IPickerActivity I select my image from the gallery:

java.lang.RuntimeException: Unable to start activity ComponentInfo{rp.com.bmicalculator/com.liuguangqiang.ipicker.crop.CropImageActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.app.ActionBar.setHomeAsUpIndicator(int)' on a null object reference
                                                                          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
                                                                          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
                                                                          at android.app.ActivityThread.-wrap11(ActivityThread.java)
                                                                          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
                                                                          at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                          at android.os.Looper.loop(Looper.java:148)
                                                                          at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                                          at java.lang.reflect.Method.invoke(Native Method)
                                                                          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                                                                       Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.app.ActionBar.setHomeAsUpIndicator(int)' on a null object reference
                                                                          at com.liuguangqiang.ipicker.crop.CropImageActivity.initToolbar(CropImageActivity.java:116)
                                                                          at com.liuguangqiang.ipicker.crop.CropImageActivity.onCreate(CropImageActivity.java:91)
                                                                          at android.app.Activity.performCreate(Activity.java:6237)
                                                                          at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
                                                                          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
                                                                          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                                                                          at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                                                                          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
                                                                          at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                          at android.os.Looper.loop(Looper.java:148) 
                                                                          at android.app.ActivityThread.main(ActivityThread.java:5417) 
                                                                          at java.lang.reflect.Method.invoke(Native Method) 
                                                                          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                                                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

 I've followed all the directions I've provided from the library author ... Can the bug be in the library? No, because I've tested the app created by the same author and everything works perfectly ...

Gugu
  • 9
  • 1

1 Answers1

0

So, I installed the library you mentioned. Everything seems to work well. Maybe you are using AppTheme with no ActionBar?

Boris Kozyrev
  • 152
  • 1
  • 5
  • Yes I using no ActionBar – Gugu Oct 14 '17 at 10:03
  • Well, if your 'IPickerTheme' parent is something like 'Theme.AppCompat.Light.NoActionBar' here comes your error. That is because IPickerActivity in library references the action bar. – Boris Kozyrev Oct 15 '17 at 18:21