I'm a new android developer.
I want to record a sound via press and hold of a button, and on release of the button, audio should be saved in external storage.
I know how to record an audio file.
please help me.
I'm a new android developer.
I want to record a sound via press and hold of a button, and on release of the button, audio should be saved in external storage.
I know how to record an audio file.
please help me.
You need to:
example:
button.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if(event.getAction() == MotionEvent.ACTION_DOWN){
// start recording.
return true;
}
if(event.getAction() == MotionEvent.ACTION_UP){
// Stop recording and save file
return true;
}
return false;
}
});
also refer this answer for a similar behaviour.