One more solution for capturing audio in Android.
You can use existing application which can capture audio for you. I am going to show example which shows how to start Sound Recorder activity:
import android.app.Activity;import android.content.Intent;import android.os.Bundle;import android.provider.MediaStore;import android.view.View;import android.widget.Button;public class Main extends Activity{private static final int REQUEST_CODE_RECORD = 0;@Overridepublic void onCreate(Bundle savedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.main);Button startRecording = (Button) findViewById(R.id.startBtn);startRecording.setOnClickListener(new View.OnClickListener(){public void onClick(View v){Intent recordIntent = new Intent(MediaStore.Audio.Media.RECORD_SOUND_ACTION);startActivityForResult(recordIntent,REQUEST_CODE_RECORD)}})}}After clicking on button Start activity you should see
Now you can record. After that you can find your recorded file in DDMS perspective -> File Explorer view ->sdcard:
That’s all.
Download code from this post.
If you’d like to get the latest posts as soon as they’re published,subscribe to our feed
No related posts.

Recent Comments