Ho lo stesso problema, che voglio usare i drawable generati da Picasso per Image Caching Purpose, ma non riesco a ottenere lo stesso. Ecco il codice che sto usando per accedere alle drawable Bitmap:Picasso onBitmapLoaded mai chiamato
Target targetBitmap = new Target() {
@Override
public void onPrepareLoad(Drawable arg0) {
}
@Override
public void onBitmapLoaded(Bitmap arg0, Picasso.LoadedFrom arg1) {
mBitmap = arg0;
BitmapDrawable d = new BitmapDrawable(context.getResources(), arg0);
int margin = 2;
int border = 0;
Rect r = new Rect(margin, margin, width - margin, height - margin);
int imageWidth = r.width();
int imageHeight = r.height();
if (imageHeight > r.height() - (border * 2)) {
imageHeight = r.height() - (border * 2);
}
r.left += ((r.width() - imageWidth)/2) - border;
r.right = r.left + imageWidth + border + border;
r.top += ((r.height() - imageHeight)/2) + border;
r.bottom = r.top + imageHeight + border + border;
Paint p = new Paint();
p.setColor(0xFFFFFF);
c.drawRect(r, p);
r.left += border;
r.right -= border;
r.top += border;
r.bottom -= border;
d.setBounds(r);
d.draw(c);
}
@Override
public void onBitmapFailed(Drawable arg0) {
}
};
Picasso.with(context).load(app.getListBookDetails().get(img_num).getImage_150x225()).into(targetBitmap);
Ma qui onBitmapLoaded metodo non viene mai chiamato. Come posso accedere a questo metodo? Si prega di aiutare se potete. Ho graffiato tutto ma è andato tutto invano.
Grazie Sanat
se si aggiunge, prima della chiamata picasso, la riga 'Log.d (" myapp ", app.getListBookDetails(). Get (img_num) .getImage_150x225());' cosa dice? – Budius
Mi mostra l'URL dell'immagine per il quale ho usato Picasso. –
La tua app dispone dell'autorizzazione di rete? Put – Budius