我一直在尝试绘制api示例:http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/graphics/FingerPaint.html并希望保存绘图,我查看了以前的答案并尝试了解决方案,但无法将其保存。Android fingerpaint api保存
我已经更换了代码的API与我使用保存代码,下面的代码的浮雕按钮:
public boolean onOptionsItemSelected(MenuItem item) {
mPaint.setXfermode(null);
mPaint.setAlpha(0xFF);
switch (item.getItemId()) {
case COLOR_MENU_ID:
new ColorPickerDialog(this, this, mPaint.getColor()).show();
return true;
case EMBOSS_MENU_ID:
String path = Environment.getExternalStorageDirectory().toString();
OutputStream fOut = null;
File file = new File(path, "screentest.jpg");
try {
fOut = new FileOutputStream(file);
mBitmap.compress(Bitmap.CompressFormat.JPEG, 85, 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();
}
我想直接将图像保存到SD卡,当我点击按钮保存,没有错误,但它不保存在SD卡下的文件,任何人有任何想法,为什么这是行不通的?
而且我已经添加了权限:提前
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
感谢
感谢
编辑:我认为这个问题是有权限或者是创建该文件的方式,我有试图创建一个文件夹,它也不会,我是否需要任何其他权限?
抱歉,我不能帮... – MByD
不管怎样,谢谢您的帮助MByD,会继续努力 – James
我也有同样的问题。但正如你所说,没有错误出现。但是当我点击保存按钮时,我收到了ForceCLose错误。请帮助我。 – Akshay