You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@OverrideprotectedvoidonActivityResult(intrequestCode, intresultCode, Intentdata) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 0) {
if (resultCode == RESULT_OK) {
// Great! User has recorded and saved the audio fileUriuri = data.getData();
} elseif (resultCode == RESULT_CANCELED) {
// Oops! User has canceled the recording
}
}
}
When the recording is successful, I execute:
Uriuri = data.getData();
it will occur errors!
this is error details:
ava.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=0, result=-1, data=null} to activity
The text was updated successfully, but these errors were encountered:
But that can be solved by using the file defined for saving the record.
Initially, you defined a path like: String filePath = Environment.getExternalStorageDirectory() + "/recorded_audio.wav";
So you can proceed like this:
@OverrideprotectedvoidonActivityResult(intrequestCode, intresultCode, Intentdata) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 0) {
if (resultCode == RESULT_OK) {
// Great! User has recorded and saved the audio fileStringfilePath = Environment.getExternalStorageDirectory() + "/recorded_audio.wav";
Uriuri = Uri.fromFile(newFile(filePath));
//Deal with the Uri now
} elseif (resultCode == RESULT_CANCELED) {
// Oops! User has canceled the recording
}
}
}
When the recording is successful, I execute:
it will occur errors!
this is error details:
The text was updated successfully, but these errors were encountered: