我正在尝试使用AddThis.shareItem(这个,“facebook”,mShareTitle,mShareDescription,myBitmap)分享图片;但我经常收到1MB缓冲区错误“FAILED BINDER TRANSACTION !!!”或Facebook“以后再试错。”
有人知道某种方法可以避免这种情况吗? (也许在共享位图之前清理缓冲区?)。
除了AddThis.shareItem(这个,“facebook”,mShareTitle,mShareDescription,myBitmap)之外,所有代码都可以正常工作;部分。
谢谢!
String imageURL= " "; //contains the path of the image on device
File imgFile = new File(imageURL);
if(imgFile.exists()){
Log.d(TAG, "imgFile.getAbsolutePath() " + imgFile.getAbsolutePath());
Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());try {
//This is what I found in http://support.addthis.com/ and works everywhere except on facebook
AddThis.shareItem(this, "facebook",mShareTitle,mShareDescription,myBitmap);
//Sharing from web works fine
AddThis.shareItem(this, "facebook", "http://example.jpg" , mShareTitle, mShareDescription);
//I've tried this but it's not working
AddThis.shareItem(this, "facebook", "imgFile.getAbsolutePath()", mShareTitle, mShareDescription);
//I've read something about avoid buffer using Uris, but I'm not doing it appropiately
AddThis.shareItem(this, "facebook", "Uri.fromFile(imgFile).getPath()", mShareTitle, mShareDescription);
//I've read something about avoid buffer using Uris, but I'm not doing it appropiately
AddThis.shareItem(this, "facebook", imageURL, mShareTitle, mShareDescription);
//Last try that doesn't work
String foo = "file://";
foo = foo.concat(imgFile.getAbsolutePath());
Log.d(TAG,"foo: "+foo);
Log.d(TAG,"imageURL: "+imageURL);
AddThis.shareItem(this, "facebook", "foo", mShareTitle, mShareDescription);
} catch (ATDatabaseException e) {
e.printStackTrace();
Log.e(TAG, "ATDatabaseException: " + e);
} catch (ATSharerException e) {
e.printStackTrace();
Log.e(TAG, "ATSharerException: " + e);
}
}
else
Log.d(TAG, "Image not found");
}