Need action listeners for cancel and phone back button in the message intent view (sms)
<p>I am trying to send SMS (text) from my android app. Consider that I am in view_A and on clicking the Button_A, I have to send a sms. </p>

<p>I used the following code to send the text and I was successful till this.</p>

<pre><code>        String aPhone = "xxxxxxxx";
        Intent aIntentSms = new Intent( Intent.ACTION_VIEW, Uri.parse("smsto:"+phone) );
        aIntentSms.putExtra( "sms_body", "Test message..." );
        startActivity(aIntentSms);  
</code></pre>

<p>Now my issues are: </p>

<ul>
<li>Once after user clicks the SEND button in message intent, a sms will be sent to the corresponding users and we will be in the same message intent view. I need something like, once user clicks the SMS button (after the text send), I have to close the message intent and display a new View_B (view in my app). How can I achieve this? Small sample code will be very useful for me.</li>
<li>Also, instead of clicking the SEND button, if user clicks the CANCEL or PHONE BACK BUTTON, I need to show corresponding alert messages. On researching I found <strong>onActivityResult</strong> can be used for this. But, how can I differentiate with the CANCEL and  PHONE BACK BUTTON (from the message intent)</li>
</ul>

<p>Please apologize if my questions are silly. Any help please.</p>

<p>Thank You. </p>
