Stopping Saving and Releasing Activity Data in onPause

When another Activity moves to the top ofthe activity stack, the current Activity is informed that it is being pushed down the activity stack by way of the onPause() method.

Here, the Activity should stop any audio, video, and animations it started in the onResume() method.This is also where you must deactivate resources such as database Cursor objects if you have opted to manage them manually, as opposed to having them managed automatically.

I Note

Android provides a number of helper utilities for managing queries and Cursor objects. We talk more about these methods in Chapter 10, "Using Android Data and Storage APIs."

The onPause() method can also be the last chance for the Activity to clean up and release any resources it does not need while in the background.You need to save any uncommitted data here, in case your application does not resume.

Easy Software Profits

Easy Software Profits

Here's How Anyone Can Start, Build and Run their Own Successful Software Empire Without Knowing the First Thing About Programming, Scripting Or Any 'Coder' Stuff. There is no doubt about it software sells. Software has a high percieved value and it solves problems for people.  A claim that can't always be made for PDF books, Video products and the like.

Get My Free Ebook


Responses

  • filiberta
    How to save object onpause?
    7 years ago

Post a comment