Friday, June 15, 2012

Re: [android-developers]



On Fri, Jun 15, 2012 at 1:16 PM, Narendra Singh Rathore <nsr.curious@gmail.com> wrote:


On Fri, Jun 15, 2012 at 12:21 PM, Vijay Krishnan <vijay.vijay702@gmail.com> wrote:
Hi all,
         How to call another activity when i press the back button.


It seems somewhat improper....but here is solution to your requirement.

 public void onBackPressed() {
           
Log.d("CDA", "onBackPressed Called");
           
Intent setIntent = new Intent(Intent.ACTION_MAIN);
            setIntent
.addCategory(Intent.CATEGORY_HOME);
            setIntent
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity
(setIntent);

           
return;
       
}  

Don't forget to Override this.

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate