Muddz / QuickShot

[Moved to MavenCentral] Capture images of any View, SurfaceView or Bitmap from your Android app in: .jpg .png or .nomedia with simple oneliner codes.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

of(bitmap) not working because of this

BarretWu opened this issue · comments

private Context getAppContext() {
    if (view == null) {
        throw new NullPointerException("Attempt to save the view failed: view was null");
    }
    return view.getContext().getApplicationContext();
}

............
new BitmapSaver(getAppContext(), getBitmap(), saveInternal, path, filename, fileExtension, jpgQuality, listener).execute();

Show me the full code your are using for saving the Bitmap + Library version + minSDK

me too
my full code is
image

@tuinui
In your line QuickShot.of(this)what isthis`? Are you refeering to an actual Bitmap object?
Also post your error stacktrace

QuickShot.of(bitmap).setResultListener(this).save()
minSdkVersion 24. implementation 'com.muddzdev:quickshot:1.1.0'

save() call BitmapSaver(getAppContext()) and in getAppContext()
if (view == null) { throw new NullPointerException....
But we did not setup view, only bitmap. Of course it's throws null

@DonnieDB Thanks! I have already fixed and version 1.2.0 should be up now.

When using Bitmap, you should now pass Context as a second parameter.
But only when saving a Bitmap.

Example:
QuickShot.of(bitmap, context).setResultListener(this).toJPG().save();