Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/211.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java BitmapFactory.decodeFile()为现有图像返回null_Java_Android_Nullable_Android Bitmap_Bitmapfactory - Fatal编程技术网

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();
返回文件;
}

可能类似的问题如下