• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

UI events to consider in all apps

 
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What UI events should I always take care of in my app? For example back button. What else should I care for?

Thanks
Imad
 
Sheriff
Posts: 9708
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think there are any universal rules as to which events you should handle. It depends a lot upon the nature of the application you are creating...
 
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Muhammad Imad Qureshi wrote:For example back button.


Overriding Back button may or may not be always required. It depends.

Ankit Garg wrote:I don't think there are any universal rules as to which events you should handle. It depends a lot upon the nature of the application you are creating...


Would second Ankit here.

However, there are certain "cases" that your code must be able to handle or tolerate(like screen orientation, low battery, incoming phone call etc.)
 
Muhammad Imad Qureshi
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

However, there are certain "cases" that your code must be able to handle or tolerate(like screen orientation, low battery, incoming phone call etc.)



My app very simple which does some calculations (lets assume its a calculator). I would like to keep my calculator running and let the user return to the screen where he/she left after taking the call. How do I implement this. Should I just do nothing and os will take care of this?

Thanks for your help
Imad
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's not how the Android lifecycle works - the app may get stopped at any time if it's not visible. Any data you wish to preserve between app invocations needs to be saved in the onPause handler (possible using SharedPreferences) and then reinstated in the onStart handler.

The android.app.Activity javadocs talk about this in more detail.
 
reply
    Bookmark Topic Watch Topic
  • New Topic