[android-developers] Re: Multiple Back Button clicks needed to exit application

2010-07-30 Thread StillALearner
Used finish(); to end an activity 


On Jul 30, 10:32 am, Priyank priyankvma...@gmail.com wrote:
 Hi,
 In my current application design, I have an activity class
 application.java (which starts on launching the application), and it
 does not have a layout(UI screen). I call another class called
 servicebind.java from the onCreate method of my 1st class. here I bind
 to the local server (bindServer()). i call back the application class
 through an intent.
  Once I am back to my application class, I call my activity class
 called welcome.java which has a layout/UI.

 When I run this application, I am able to see the welcome screen. But
 the problem is, when I click on the back button, I get a black screen
 with just the title on top. I have to hit back button 3 times to exit
 the application.

 The reason I see from the logs is that, the 1st 2 activity classes
 (application.java and services.java) does not get destroyed unless I
 hit the back button. So the 1st time I hit back button, the welcome
 activity gets destroyed. the next back button destroys the servicebind
 class and final back destroys the application class.
 Is the reason because these classes dont have a UI to display in the
 onCreate method.

 I do not want to change my design where I bind the service in the
 servicebind class and call the welcome activity in the application
 class.

 can anyone please help me find a way to avoid pressing the back button
 multiple times to exit.
 Please let me know if you dont understand my question.

 Thanks,
 Priyank

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


Re: [android-developers] Re: Multiple Back Button clicks needed to exit application

2010-07-30 Thread Jenus Dong
yeah,the welcome activity has the reference of the application activity, you
can call activity.finish() of the application, and there you can overide the
finish function of the application, make destory the servicebind.
Hope it could be helpful.

On Fri, Jul 30, 2010 at 3:33 PM, StillALearner k.mad...@gmail.com wrote:

 Used finish(); to end an activity 


 On Jul 30, 10:32 am, Priyank priyankvma...@gmail.com wrote:
  Hi,
  In my current application design, I have an activity class
  application.java (which starts on launching the application), and it
  does not have a layout(UI screen). I call another class called
  servicebind.java from the onCreate method of my 1st class. here I bind
  to the local server (bindServer()). i call back the application class
  through an intent.
   Once I am back to my application class, I call my activity class
  called welcome.java which has a layout/UI.
 
  When I run this application, I am able to see the welcome screen. But
  the problem is, when I click on the back button, I get a black screen
  with just the title on top. I have to hit back button 3 times to exit
  the application.
 
  The reason I see from the logs is that, the 1st 2 activity classes
  (application.java and services.java) does not get destroyed unless I
  hit the back button. So the 1st time I hit back button, the welcome
  activity gets destroyed. the next back button destroys the servicebind
  class and final back destroys the application class.
  Is the reason because these classes dont have a UI to display in the
  onCreate method.
 
  I do not want to change my design where I bind the service in the
  servicebind class and call the welcome activity in the application
  class.
 
  can anyone please help me find a way to avoid pressing the back button
  multiple times to exit.
  Please let me know if you dont understand my question.
 
  Thanks,
  Priyank

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


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