I was trying to save an mp3 file into my application res/raw/
folder but i dont know actualy how to do this..
When button is clicked
OnClickListener button2 = new OnClickListener(){
@Override
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("file/*");
int YOUR_RESULT_CODE = 0;
intent.getData();
startActivityForResult(intent, YOUR_RESULT_CODE);
}
};
That was because i want to use a file explorer to select my .mp3 file type
Now how can i save the selected file to a specific folder (res/raw) into
my application
public File getTempFile(Context context, String url) {
//should i add something here?
File file1 = null;
try {
String FileName = Uri.parse(url).getLastPathSegment();
file1 = File.createTempFile(FileName, null, context.getCacheDir());
}
catch (IOException e) {
}
return file1;
}
I would much appreciate if your examples contain code
thanks in advance :)