大佬教程收集整理的这篇文章主要介绍了android java.io.File.fixSlashes(File.java:185),大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
java.lang.NullPointerException at java.io.File.fixSlashes(File.java:185) at java.io.File.<init>(File.java:134)
public static String sharePhoto(Context context,Bitmap bmp) { File folder = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/Pictures/Folder"); Boolean success = true; String file_path = null; if (!folder.exists()) { success = folder.mkdir(); } if (success) { file_path = folder + "/Img_" + System.currentTimeMillis() / 1000 + ".jpg"; } OutputStream os = null; try { os = new FiLeoutputStream(file_path); bmp.compress(Bitmap.CompressFormat.JPEG,100,os); } catch (IOException E) { e.printStackTrace(); } } else { // Do something else on failure } Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCAnnER_SCAN_FILE); File f = new File(file_path); Uri contentUri = Uri.fromFile(f); mediaScanIntent.setData(contentUri); context.sendBroadcast(mediaScanIntent); return file_path; }
以上是大佬教程为你收集整理的android java.io.File.fixSlashes(File.java:185)全部内容,希望文章能够帮你解决android java.io.File.fixSlashes(File.java:185)所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。