1
我需要共享,一個外部圖像的URL與文字一起, 從web視圖,但由於某種原因,我得到各個畢加索覆蓋誤差共享圖像的URL +文字:的Android使用畢加索
已經實施的Android中的Javascript界面。
@JavascriptInterface
public void shareContent(String text, String imageURL){
shareData(text, imageURL);
}
錯誤,我得到:Method does not override method from its superclass
。
public void shareData(String url) {
Picasso.with(getApplicationContext()).load(url).into(new AppLink.Target() {
@Override public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("image/*");
i.putExtra(Intent.EXTRA_STREAM, getLocalBitmapUri(bitmap));
startActivity(Intent.createChooser(i, "Share Image"));
}
@Override public void onBitmapFailed(Drawable errorDrawable) { }
@Override public void onPrepareLoad(Drawable placeHolderDrawable) { }
});
}
並獲取本地保存的圖像
public Uri getLocalBitmapUri(Bitmap bmp) {
Uri bmpUri = null;
try {
File file = new File(getExternalFilesDir(Environment.DIRECTORY_PICTURES), "share_image_" + System.currentTimeMillis() + ".png");
FileOutputStream out = new FileOutputStream(file);
bmp.compress(Bitmap.CompressFormat.PNG, 90, out);
out.close();
bmpUri = Uri.fromFile(file);
} catch (IOException e) {
e.printStackTrace();
}
return bmpUri;
}
如何這是不是重複? https://stackoverflow.com/questions/23681177/picasso-load-image-from-filesystem –
我是。您正在從磁盤讀取文件,然後調用共享意圖。不知道爲什麼畢加索甚至在這裏需要 –
爲了表現。 – Isabelle