【发布时间】:2014-08-19 23:01:58
【问题描述】:
我尝试将图像分享到环聊,但“file.exists()”是错误的...有什么建议吗?
Intent hangouts = new Intent(Intent.ACTION_SEND);
if(!Utilities.isNullorEmpty(urlImage)){
File file = new File(urlImage + JPEG_EXT);
hangouts.setType(MIME_TYPE_IMG);
if(Utilities.copyFile(urlImage, file.getPath()) && file.exists()){
hangouts.putExtra(Intent.EXTRA_STREAM, file.getPath());
}else{
Log.e(TAG, "Unable to locate the image on disk, sending mail without attached image.");
}
}else{
hangouts.setType(MIME_TYPE_TP);
}
hangouts.setPackage(PACKAGE_H);
hangouts.putExtra(Intent.EXTRA_TEXT, message + ": \n" + urlShare);
startActivity(Intent.createChooser(hangouts, "Hangouts is not installed."));
【问题讨论】:
标签: android image share hangout