bitmap
变量bitmap
中的imageFile
图片,其名称为bitmap
我们如何进一步命名此bitmap
图片并将其存储在我的移动内存中
在此图片中显示接收图像文件并将其转换为void Cell::setNeighbors(std::vector<Cell*> neighbors)
{
_neighbors = neighbors;
}
答案 0 :(得分:0)
1-您必须找到保存图像的路径。
2-打开一个OutputStream对象并为其指定文件路径。
3-将位图保存到输出流。
4-同花顺。
5-关闭。
// Get environment dir
String path = Environment.getExternalStorageDirectory().toString();
OutputStream fOut = null;
File file = new File(path, "MyImage"+".jpg"); // the File to save to
fOut = new FileOutputStream(file);
Bitmap pictureBitmap = BitmapFactory.decodeFile(imageFile.getAbsolutePath(), optons); // obtaining the Bitmap
pictureBitmap.compress(Bitmap.CompressFormat.JPEG, 100, fOut); // saving the Bitmap to a file compressed as a JPEG with 85% compression rate
fOut.flush(); // Not really required
fOut.close(); // do not forget to close the stream