I am trying to resize an image from my gallery to fit the image and save its bitmap after fitting so that I can upload it to my Parse database when I click the add button. Currently, when the "Add" button is clicked, I check if the bitmap is zero, and if not, convert it to Parsefile, which will be saved in my analysis database. Adding to the database works (I tested this without using Picasso), but I'm not sure how to get the bitmap if I use Picasso to resize and load. I tried to create a Target and use its callbacks, but I cannot use .fit () for the purpose. I resorted to using a callback, but I was hoping for a better way to achieve preservation of the bitmap.
Here's what I'm doing right now, trying to get a bitmap from an image after downloading it:
if(uri != null) { Picasso.with(mContext).load(uri).skipMemoryCache().fit().centerCrop().into(imgPreview, new Callback() { @Override public void onSuccess() { mBitmap = ((BitmapDrawable)imgPreview.getDrawable()).getBitmap(); } @Override public void onError() {
source share