描画パーツを作成していて、指定したカメラフォルダに画像を保存するために次のコードを記述しました。ただし、アプリ名を使用して新しいフォルダーを作成し、そのフォルダーに画像を保存したいと思います。どうすればそれを作ることができますか?
また、後でその特定のフォルダから画像ファイルを取得したいと思います。
ありがとう!
現在のコード:
String fileName = "ABC";
// create a ContentValues and configure new image's data
ContentValues values = new ContentValues();
values.put(Images.Media.TITLE, fileName);
values.put(Images.Media.DATE_ADDED, System.currentTimeMillis());
values.put(Images.Media.MIME_TYPE, "image/jpg");
// get a Uri for the location to save the file
Uri uri = getContext().getContentResolver().insert(Images.Media.EXTERNAL_CONTENT_URI, values);
try
{
OutputStream outStream = getContext().getContentResolver().openOutputStream(uri);
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, outStream);
outStream.flush(); // empty the buffer
outStream.close(); // close the stream