I've made a small android application allowing the user to select a soundfile which plays in the background of the sketch.
Well, I'm using this code:
The file picker successfully launches and I can pick a sound file… But onActivityResult() is not called when returning from an external application (like the Android musiclibrary). If I use an application that just overlays over my sketch (like the WhatsApp soundrecorder) onActivityResult() is called and I can process the returned data. Some guys on Google figured out that it might be a problem with Processing running as an Activity - not as a Fragment.
Did anyone stumbled upon this problem before? Any solutions?
Thanks in advance.
krys
Well, I'm using this code:
- void loadSoundFile() {
Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Audio.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent,FILE_REQUEST_CODE);
} - @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) {
println("ok");
} else {
println("damn - its not working");
}
}
The file picker successfully launches and I can pick a sound file… But onActivityResult() is not called when returning from an external application (like the Android musiclibrary). If I use an application that just overlays over my sketch (like the WhatsApp soundrecorder) onActivityResult() is called and I can process the returned data. Some guys on Google figured out that it might be a problem with Processing running as an Activity - not as a Fragment.
Did anyone stumbled upon this problem before? Any solutions?
Thanks in advance.
krys
3