Java BitmapFactory.decodeFile()为现有图像返回null
我现在面临一个问题。 我尝试了以下建议。 但是上面的建议对我没有帮助 代码:Java BitmapFactory.decodeFile()为现有图像返回null,java,android,nullable,android-bitmap,bitmapfactory,Java,Android,Nullable,Android Bitmap,Bitmapfactory,我现在面临一个问题。 我尝试了以下建议。 但是上面的建议对我没有帮助 代码: private File createPhotoFile()引发IOException{ String timeStamp=new SimpleDateFormat(“yyyyMMdd_HHmmss”,Locale.getDefault()).format(new Date()); 字符串imageFileName=“IMG_u“+时间戳+”; File storageDir=getExternalFilesDir(
private File createPhotoFile()引发IOException{
String timeStamp=new SimpleDateFormat(“yyyyMMdd_HHmmss”,Locale.getDefault()).format(new Date());
字符串imageFileName=“IMG_u“+时间戳+”;
File storageDir=getExternalFilesDir(Environment.DIRECTORY\u图片);
File image=File.createTempFile(imageFileName,.png,.storageDir);
字符串mccurrentphotopath=image.toString();
BitmapFactory.Options bmOptions=新的BitmapFactory.Options();
位图位图=BitmapFactory.decodeFile(mCurrentPhotoPath,bmOptions);
//位图=位图.createScaledBitmap(位图,parent.getWidth(),parent.getHeight(),true);
位图markedImage=水印(位图,“您的字符串”,Color.RED,90,90,true);
文件=新文件(“路径”);
OutputStream os=new BufferedOutputStream(新文件OutputStream(String.valueOf(MarkeImage));
compress(bitmap.CompressFormat.JPEG,100,操作系统);
os.close();
返回文件;
}
可能类似的问题如下