Skip to content
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

NullPointerException upon opening GalleryActivity #18

Open
kckunal2612 opened this issue Sep 19, 2017 · 0 comments
Open

NullPointerException upon opening GalleryActivity #18

kckunal2612 opened this issue Sep 19, 2017 · 0 comments

Comments

@kckunal2612
Copy link

kckunal2612 commented Sep 19, 2017

I am opening the GalleryActivity by the following statements (Kotlin) -

        val intent = Intent(context, GalleryActivity::class.java)
        val params = Params()
        // set Picker Limit to ONE to enable only SINGLE IMAGE click
        params.pickerLimit = 1
        params.toolbarColor = resources.getColor(R.color.colorPrimary)
        params.actionButtonColor = resources.getColor(R.color.colorPrimary)
        intent.putExtra(Constants.KEY_PARAMS, params)
        startActivityForResult(intent, Constants.TYPE_MULTI_PICKER)

Upon opening the GalleryActivity, I get a "NullPointerException" at the bottom (in a Snackbar), and the following message in the exception stacktrace -
System.err: at com.vlk.multimager.activities.GalleryActivity$ApiSimulator.doInBackground(GalleryActivity.java:339)

GalleryActivity -

protected ArrayList<Image> doInBackground(@NonNull Void... voids) {
         ArrayList images = new ArrayList();
         Cursor imageCursor = null;

         try {
             String[] e = new String[]{"_id", "_data", "date_added", "height", "width"};
             String orderBy = "date_added DESC";
             imageCursor = GalleryActivity.this.getContentResolver().query(Media.EXTERNAL_CONTENT_URI, e, (String)null, (String[])null, "date_added DESC");

             ---> while(imageCursor.moveToNext()) {
                 long _id = imageCursor.getLong(imageCursor.getColumnIndex("_id"));
      

Here is the screenshot of the error -

screenshot_1505824908

This is only happening on devices with API Level 16 (ICS), but not on devices with API levels >= 19 (kitkat).
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant