이미지 처리 후에 저장을 해야 하는데
제가 원하는 폴더에 원하는 이름으로 저장을 하고 싶습니다.
어플 깔릴 때 새 폴더 생성하는 방법 좀 알려주세요
그리고 가능하시다면 이미지 저장할 때 원하는 이름으로 저장하는 방법도 좀...
정확한 답변은 아니지만 참고삼어 제가 사용하는 코딩을 올려드리니
응용하시면 원하시는 답을 찿으실 수 있을듯...
......이전생략
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.main);
setMakeDir("onAir/brodlogo") ; //디렉토리 생성
setFileCopy("brodlogo"); //파일 복사
setMedScan();//sdcard scan
......이후 생략
//인자값대로 sdcard에 폴더 생성
public void setMakeDir(String makeDir) {
File sdcard = Environment.getExternalStorageDirectory();
File DirName = new File(sdcard.getAbsolutePath() + File.separator + makeDir);
if(!DirName.exists()){
showLog("Create DB directory. ", DirName.getAbsolutePath());
DirName.mkdirs();
}
}
//그림 파일을 복사 (assets -> sdcard)
private void setFileCopy(String mdir) {
AssetManager assetManager = getResources().getAssets();
InputStream is = null;
String files[] = null;
long filesize = 0;
FileOutputStream fo = null;
try {
files = assetManager.list(mdir);
for (int i = 0; i < files.length; i++){
is = assetManager.open(mdir + "/" + files[i], AssetManager.ACCESS_BUFFER);
filesize = is.available();
File outfile = new File("sdcard/onAir/" + mdir + "/" + files[i]);
if(outfile.length() != filesize){
byte[] tempdata = new byte[(int) filesize];
is.read(tempdata);
is.close();
outfile.createNewFile();
fo = new FileOutputStream(outfile);
fo.write(tempdata);
fo.close();
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
//sdcard 내용을 Re Scan
public void setMedScan() {
IntentFilter intentFilter = new IntentFilter(Intent.ACTION_MEDIA_SCANNER_STARTED);
intentFilter.addAction(Intent.ACTION_MEDIA_SCANNER_FINISHED);
intentFilter.addDataScheme("file");
registerReceiver(mReceiver, intentFilter);
sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://"
+ Environment.getExternalStorageDirectory())));
unregisterReceiver(mReceiver);
}
//Re Scan 후 결과 리스너
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Intent.ACTION_MEDIA_SCANNER_STARTED)) {
//showLog("Media Scanner started scanning ", intent.getData().getPath());
}
else if (intent.getAction().equals(Intent.ACTION_MEDIA_SCANNER_FINISHED)) {
//showLog("Media Scanner finished scanning " , intent.getData().getPath());
}
}
};
도움이 되셨으면 좋겠습니다...



