hey hi, i'm doing a similar program for my school too, but i cant make it to work. do you think you can help me? i think i have the code written correctly, and i have added the permission too. please help. thanks
package capstoneProject.AudioRecording; import android.app.Activity; import android.media.MediaRecorder; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; public class AudioRecording extends Activity { /** Called when the activity is first created. */ private Button buttonRecording, buttonStopRecording; private EditText textRecording, textStopRecording; private String Path_Name = "sdcard/audio4"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); textRecording = (EditText) findViewById(R.id.text1); textStopRecording = (EditText) findViewById(R.id.text2); buttonRecording = (Button) findViewById(R.id.buttonRecording); buttonStopRecording = (Button) findViewById (R.id.buttonStopRecording); buttonRecording.setOnClickListener(new clicker()); buttonStopRecording.setOnClickListener(new clicker()); } class clicker implements Button.OnClickListener { public void onClick(View v) { MediaRecorder audioRecorder = new MediaRecorder(); if(v==buttonRecording){ //textRecording.setText("Recording"); //textStopRecording.setText(""); audioRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); audioRecorder.setOutputFormat (MediaRecorder.OutputFormat.THREE_GPP); audioRecorder.setAudioEncoder (MediaRecorder.AudioEncoder.AMR_NB); audioRecorder.setOutputFile(Path_Name); audioRecorder.prepare(); audioRecorder.start(); // Recording is now started } if(v==buttonStopRecording){ textStopRecording.setText("Stop Recording"); textRecording.setText(""); audioRecorder.stop(); audioRecorder.reset(); // You can reuse the object by going back to setAudioSource() step audioRecorder.release(); // Now the object cannot be reused //String tag, label; //TimingLogger timeRecord = new TimingLogger(tag, label); } } } } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---