Creator 游戏截屏 QQ分享

Ts 截屏保存到可读路径下path:

final Bundle params = new Bundle();
String sharePath = saveBitmap(app , BitmapFactory.decodeFile(path));
public static String saveBitmap(Context context, Bitmap mBitmap) {
String savePath;
File filePic;
if (Environment.getExternalStorageState().equals(
Environment.MEDIA_MOUNTED)) {
savePath = "/sdcard/djs/pic/";
} else {
savePath = context.getApplicationContext().getFilesDir()
.getAbsolutePath()
+ "/djs/pic/";
}
try {
filePic = new File(savePath + "result_share.jpg");
if (filePic.exists()) {
filePic.delete();
}else{
filePic.getParentFile().mkdirs();
filePic.createNewFile();
}
FileOutputStream fos = new FileOutputStream(filePic);
mBitmap.compress(Bitmap.CompressFormat.JPEG, 100, fos);
fos.flush();
fos.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
return filePic.getAbsolutePath();
}

则 sharePath为QQ所分享的路径

posted on 2019-08-12 10:33  孤傲的蜗牛  阅读(167)  评论(0编辑  收藏  举报

导航