Not getting desired value in "onActivityResult"
<p>Warning</p>

<pre><code>**07-07 15:24:25.021: WARN/ActivityManager(57): Activity is launching as a new task, so cancelling activity result.**
07-07 15:24:25.681: WARN/ActivityManager(57): Activity pause timeout for HistoryRecord{43cccce8 com.tcs.QuickNotes/.QuickNotesHome}
07-07 15:24:27.392: INFO/AudioPathIn onActivityResult(1370):  onActivityResult
07-07 15:24:27.410: INFO/requestCode(1370): requestCode1
07-07 15:24:27.420: INFO/resultCode(1370): **resultCode0**
</code></pre>

<p>My code</p>

<pre><code>@Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        Log.i("AudioPathIn onActivityResult"," onActivityResult"+audioFilePath.getText().toString());
        Log.i("requestCode ","requestCode"+requestCode);
        Log.i("resultCode ","resultCode"+resultCode);
        if(requestCode == 1)
        {
            if(resultCode == RESULT_OK)
            {
                Audioflag=1;
                audioFilePath.setVisibility(View.VISIBLE);

                String defaultToneStatus = data.getStringExtra("DefaultTone");
                if(defaultToneStatus.equals("false"))
                {
                    audioFilePath.setText(AudioRecorder.getFilePath());
                }
                else
                {
                    defaultAudioToneFlag = 1;
                    audioFilePath.setText("-");
                }

            }else
            {
                Audioflag=0;
            }
        }

    }
</code></pre>

<p>Its not entering the above code. 
Result code is always 0;</p>

<p>Code from where control is being returned :</p>

<pre><code>public class AudioRecorder extends Activity implements OnClickListener {


    String p = null;
    static String filePath,FlagFromEdit,primaryIdFromEdit;
    static int pId;
    static int audioFlag;
    Intent intent;
    CheckBox defaultRingtone;

    MyRecorder recorder;
    /** Called when the activity is first created. */
    @Override    
    public void onCreate(Bundle savedInstanceState) 
    {
        /** Called when the activity is first created. */

        super.onCreate(savedInstanceState);
        setContentView(R.layout.voicenote);
        audioFlag=0;
        intent=getIntent();
        p = intent.getStringExtra("primaryiid");
        pId = (Integer.parseInt(p));
        Log.v("p", "pid" +pId);
        setResult(RESULT_CANCELED);
//      FlagFromEdit=intent.getStringExtra("FlagFromEdit");
//      primaryIdFromEdit=intent.getStringExtra("PrimaryId");
        defaultRingtone = (CheckBox)findViewById(R.id.Cb_defaultRingtone);
        defaultRingtone.setOnClickListener(this);

        Button btn_record = (Button)findViewById(R.id.btn_record);
        btn_record.setOnClickListener(btnListenerRecord);

        Button btn_stop = (Button)findViewById(R.id.btn_stop);
        btn_stop.setOnClickListener(btnListenerStop);

        Button btn_play = (Button)findViewById(R.id.btn_play);
        btn_play.setOnClickListener(btnListenerPlay);

        Button btn_save = (Button)findViewById(R.id.btn_save);
        btn_save.setOnClickListener(btnListenerSave);
    }


    private OnClickListener btnListenerRecord = new OnClickListener()
    {
        public void onClick(View v) 
        {
            try
            {

                recorder = new MyRecorder("voice/" + pId + "");
                recorder.start();
                Toast.makeText(getBaseContext(),"Recording started !", Toast.LENGTH_LONG).show();

            } 
            catch (Exception e)
            {
                e.printStackTrace();
            }
        }
    }; 

    private OnClickListener btnListenerStop = new OnClickListener()
    {
        public void onClick(View v)
        {
            MediaPlayer mp = new MediaPlayer();

            try 
            {
                recorder.stop();
                Toast.makeText(getBaseContext(),"Stop ! IsPlaying : " + mp.isPlaying(), Toast.LENGTH_LONG).show();

            } 
            catch (Exception e)
            {
                e.printStackTrace();
            }
        }
    }; 


    private OnClickListener btnListenerPlay = new OnClickListener()
    {
        public void onClick(View v)
        { 
            MediaPlayer mp = new MediaPlayer(); 

            try 
            {
                mp.setDataSource("/sdcard/voice/"+ pId + ".3gp");// set data-source
                mp.prepare();// prepare
                mp.start();
                Toast.makeText(getBaseContext(), "Playing File no : "+pId, Toast.LENGTH_LONG).show();
            }
            catch (Exception e)
            {
                e.printStackTrace();
            }

            Toast.makeText(getBaseContext(), " Is playing ? : "+ mp.isPlaying(),
                    Toast.LENGTH_LONG).show();
        }
    };


    private OnClickListener btnListenerSave = new OnClickListener()
    {
        public void onClick(View v) 
        {
            try
            {
                //              String fileName = "/sdcard/voice/"+ pId + ".3gp";
                //              Intent intentSave =  new Intent(getBaseContext(),AddToDoList.class);
                //              intentSave.putExtra("SavedFile", fileName);
                //              intentSave.putExtra("CalledFrom", "AudioRecorder");
                //              startActivity(intentSave);
                audioFlag=1;
                Toast.makeText(AudioRecorder.this,"File saved successfully !",Toast.LENGTH_LONG).show();
                Intent intent = new Intent();
                intent.putExtra("DefaultTone", "false");
                setResult(RESULT_OK,intent);
                finish();
            } 
            catch (Exception e)
            {
                e.printStackTrace();
            }
        }
    };

    public static int getAudioFlag()
    {
        return audioFlag;
    }

    public static String getFilePath()
    {
        filePath ="/sdcard/voice/"+ pId + ".3gp";
        return filePath;
    }


    public static void playAudioFile(Context ctx,String pId)
    {
        MediaPlayer mp = new MediaPlayer(); 

        try 
        {
            Log.i("playaudiofile","file being played");
            //Toast.makeText(ctx,"file being played",Toast.LENGTH_LONG).show();
            Toast.makeText(ctx, "Playing File no : "+pId, Toast.LENGTH_LONG).show();
            mp.setDataSource("/sdcard/voice/"+ pId + ".3gp");// set data-source
            mp.prepare();// prepare
            mp.start();

        }
        catch (Exception e)
        {
            Toast.makeText(ctx, " No file was assigned ", Toast.LENGTH_LONG).show();
            e.printStackTrace();
        }

    }

    @Override
    public void onClick(View arg0) {
        // TODO Auto-generated method stub
        Toast.makeText(AudioRecorder.this,"Default ringtone set !",Toast.LENGTH_LONG).show();
        Intent intent = new Intent();
        intent.putExtra("DefaultTone", "true");
        setResult(RESULT_OK,intent);
        finish();   
    }

}
</code></pre>
