问题描述
||
有人可以帮我在存储区下面的代码而不是SD卡上进行缓存。我正在截取我的应用程序的屏幕快照,以用于在社交媒体上共享。
// image naming and path to include sd card
String mPath = Environment.getExternalStorageDirectory().toString() + \"/\" + ACCUWX.IMAGE_APPEND;
// create bitmap screen capture
Bitmap bitmap;
View v1 = mCurrentUrlMask.getRootView();
v1.setDrawingCacheEnabled(true);
bitmap = Bitmap.createBitmap(v1.getDrawingCache());
v1.setDrawingCacheEnabled(false);
OutputStream fout = null;
imageFile = new File(mPath);
try {
fout = new FileOutputStream(imageFile);
bitmap.compress(Bitmap.CompressFormat.JPEG,90,fout);
fout.flush();
fout.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
这是我的社交媒体代码,用于共享屏幕截图:
Intent socialIntent = new Intent(Intent.ACTION_SEND);
socialIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
Uri uri = Uri.fromFile(new File(mPath));
socialIntent.putExtra(Intent.EXTRA_STREAM,uri);
socialIntent.setType(\"image/jpeg\");
startActivity(Intent.createChooser(socialIntent,\"How do you wanna share?\"));
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)