我需要与文字分享外部图片网址 从WebView但由于某种原因我在每个Picasso覆盖上都会出错:
已经在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;
}
答案 0 :(得分:0)
看起来你试图实现Picasso的方法,但你实际上是为Applink.Target做了这个
into(new AppLink.Target() {
我认为你正在寻找这个
into(new com.squareup.picasso.Target() {