I use a intent for record a sound.
But I don't know how save this sound in sdcard. I create a folder "file.mkdirs();". How catch the record and save on new folder (and change name)?
If is posible need save record afer push "Save" button no inmediately after record. I think need a var "recorded", if his is 0 not is recorded and if is 1 yes.
Afer on save function check if the sound are recorded and save in folder.
public class ObjSuperior extends ActionBarActivity {
int peticion = 1;
Uri url1;
int recorded = 0;
private final String ruta_Sonidos = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) + "/Gueopic/";
private File file = new File(ruta_Sonidos);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_obj_superior);
//Si no existe crea la carpeta donde se guardaran las fotos
file.mkdirs();
}
public void grabarSo(View v) {
Intent intent = new Intent(MediaStore.Audio.Media.RECORD_SOUND_ACTION);
startActivityForResult(intent, peticion);
}
public void save(){
//check if file are recorded and save on folder
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK && requestCode == peticion) {
url1 = data.getData();
}
}