2014-01-11 4 views
0

에 음악 디렉토리에 파일 저장 .mp3 파일을 sdCard의 음악 디렉토리에 저장하려면 어떻게해야합니까?Sd 카드 안드로이드

은 항상 아래의 코드는 확장없이 다운로드 폴더에 파일을 저장

private FileOutputStream getOutStream(String fileName) throws FileNotFoundException{ 
    if (Environment.getExternalStorageState().equals(
      Environment.MEDIA_MOUNTED)) { 
     String sdpath = Environment.getExternalStorageDirectory() 
       + "/"; 
     mSavePath = sdpath + "download"; 
     File file = new File(mSavePath); 

     if (!file.exists()) { 
      file.mkdir(); 
     } 
     File saveFile = new File(mSavePath, fileName); 
     return new FileOutputStream(saveFile); 
     }else{ 
     mSavePath = mContext.getFilesDir().getPath(); 
     return mContext.openFileOutput(fileName ,   Context.MODE_WORLD_READABLE); 
    } 
    } 

답변

1
mSavePath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC); 
File file = new File(mSavePath+"/filename.mp3"); 
관련 문제