0

When i do debug it didnt go to try block than catch block , this is my code please help me!

public void onClick(View v) {
               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);
                 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);


                } catch (Exception e) {
                // TODO: handle exception
            }
}
        });
Akram
  • 7,548
  • 8
  • 45
  • 72

1 Answers1

0

either set the "onClick" attribute to the view you wish (via the layout) , or find it right after the "setContentView" using "findViewById" and then use "setOnClickListener" for the view .

about "OnActivityResult", you need to put it in the activity itself as a stand alone method .

android developer
  • 114,585
  • 152
  • 739
  • 1,270