In DDMS perspective there is a cool view for such a problem (when you're
looking for a file), it's the so called File Explorer view...
And, you should read that :
http://developer.android.com/reference/android/content/Context.html#getExternalFilesDir(java.lang.String)
Regards,
Mathias Seguy - Android2EE
Le jeudi 26 juillet 2012 12:29:46 UTC+2, Meena Rengarajan a écrit :
>
> Hi all ,
> This is my code, I am very new to Android . Please can anyone
> help me .. I wanna record, play, save and stop in Audio Capture, when i
> click button all these actions should be taken . My code is here , in
> Emulator output is displaying but in my mobile , it doesnt able to identify
> the location of file uri and file name . What should i do in this?
>
>
> public class AudioCaptureActivity extends Activity {
> TextView tv;
> Button recordBtn;
> Button playBtn;
> Button saveBtn;
> Button stopBtn;
> Button finishBtn;
> MediaPlayer mp;
> MediaRecorder mr;
> Intent audioIntent;
> Uri mCapturedAudioUri;
> String path;
> int playBackPosition=0;
> int RQS_RECORDING = 1;
> int requestCode=0;
> public static int RECORD_REQUEST=0;
> /** Called when the activity is first created. */
> @Override
> public void onCreate(Bundle savedInstanceState) {
> super.onCreate(savedInstanceState);
> setContentView(R.layout.main);
> tv=(TextView)findViewById(R.id.AudioCapture);
> recordBtn=(Button)findViewById(R.id.recordBtn);
> playBtn=(Button)findViewById(R.id.playBtn);
> saveBtn= (Button)findViewById(R.id.saveBtn);
> stopBtn=(Button)findViewById(R.id.stopBtn);
>
> recordBtn.setOnClickListener(new OnClickListener() {
> @Override
> public void onClick(View v) {
> //mp= new MediaPlayer();
> //mr.setAudioSource(MediaRecorder.AudioSource.MIC);
> //mr.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
> //mr.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
> //FileDescriptor PATH_NAME = null;
> //mr.setOutputFile(PATH_NAME);
> try {
> path = Environment.getExternalStorageDirectory()+"/audio_meena.AMR";
> File newFile = new File(path);
> Uri uri =Uri.fromFile(newFile);
> Intent audioIntent=new
> Intent(MediaStore.Audio.Media.RECORD_SOUND_ACTION);
>
> startActivityForResult(audioIntent, RQS_RECORDING);
>
>
>
> } catch (Exception e) {
> // TODO: handle exception
> }
> }
> });
>
> playBtn.setOnClickListener(new OnClickListener() {
> @Override
> public void onClick(View v) {
> playAudio();
>
> // TODO Auto-generated method stub
> }
> private void playAudio() {
> // TODO Auto-generated method stub
> }
> });
> saveBtn.setOnClickListener(new OnClickListener() {
> @Override
> public void onClick(View v) {
> saveAudio();
> // TODO Auto-generated method stub
> }
> private void saveAudio() {
> // TODO Auto-generated method stub
> }
> });
>
> stopBtn.setOnClickListener(new OnClickListener() {
> @Override
> public void onClick(View v) {
> //if(v==finishBtn){
> // finish();
> // } else if(v==stopBtn)
> {
> mr.stop();
> mr.release();
> }
> // TODO Auto-generated method stub
> }
> });
> }
> //public void onActivityResult (int requestCode, int resultCode,
> Intent data) {
> //if(requestCode==1){
> // if(resultCode==RESULT_OK){
> // Uri mCapturedAudioUri=audioIntent.getData();
> // playAudio(mCapturedAudioUri);
> // }
> // }
>
> // }
> private void playAudio(Uri mCapturedAudioUri2) {
> // TODO Auto-generated method stub
> }
>
> }
>
>
>
>
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en