linear programming persistent data n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Linear Programming Persistent Data PowerPoint Presentation
Download Presentation
Linear Programming Persistent Data

Loading in 2 Seconds...

play fullscreen
1 / 7

Linear Programming Persistent Data - PowerPoint PPT Presentation


  • 77 Views
  • Uploaded on

Linear Programming Persistent Data. “Call Back” programming Persistent Data. onLoad. Declare GUI & Data. Framework. On Gui Event. Operate on GUI & Data. Gui and Data objects persist until explicitly destructed. All Gui and Data objects are accessible

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Linear Programming Persistent Data' - neron


Download Now An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
call back programming persistent data
“Call Back” programmingPersistent Data

onLoad

Declare

GUI & Data

Framework

On Gui Event

Operate on

GUI & Data

Gui and Data objects persist until explicitly destructed.

All Gui and Data objects are accessible

since they are declared in common code.

for android
For Android

onCreate

Declare

GUI & Data

Framework

On Gui Event

Operate on

GUI & Data

onDestroy

Destruct

(can occur at any time w/o your consent)

  • Gui and Data Do Not Persist
  • References to Gui objects can not be held “globally”, since those objects don’t persist.
  • One Activity can not reference objects or data in another Activity.
a proper android solution
A Proper Android Solution
  • Put common, persistent code in a Service.
  • Invoke Activities, as needed, from the Service.
  • Keep most (if not all) persistent state in the Service – not in the Activities.
  • Con:
    • Overhead of the Activity-Service communication mechanism (from both coding and runtime perspectives).
an alternative solution
An Alternative Solution
  • Put common, persistent code in the Application Class, or a class referenced from the Application Class.
  • Keep persistent state in both the Application Class and the Activities.
  • Con:
    • Need to keep the Application Class alive.
declaring and using an application class
Declaring and Using an Application Class

1. Extend the Framework Application

public myApplicationClass extends android.app.Application

2. Access the Application class from any Activity

(myApplicationClass) this.Activity.getApplication();

3. Use a trivial service to keep the Application alive

a) tell framework to put service in foreground and give it

a notification object. [ Service.startForeground() ]

b) periodically send a message from the service to the

Application and send a message back to the service.

final thoughts
Final Thoughts

The Proper Android approach is more reliable and thus a better solution.

The Application Class approach has its usefulness in particular, when porting from a more classical model.