• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2006 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.content;
18 
19 import android.content.res.Configuration;
20 
21 /**
22  * The set of callback APIs that are common to all application components
23  * ({@link android.app.Activity}, {@link android.app.Service},
24  * {@link ContentProvider}, and {@link android.app.Application}).
25  */
26 public interface ComponentCallbacks {
27     /**
28      * Called by the system when the device configuration changes while your
29      * component is running.  Note that, unlike activities, other components
30      * are never restarted when a configuration changes: they must always deal
31      * with the results of the change, such as by re-retrieving resources.
32      *
33      * <p>At the time that this function has been called, your Resources
34      * object will have been updated to return resource values matching the
35      * new configuration.
36      *
37      * @param newConfig The new device configuration.
38      */
onConfigurationChanged(Configuration newConfig)39     void onConfigurationChanged(Configuration newConfig);
40 
41     /**
42      * This is called when the overall system is running low on memory, and
43      * would like actively running process to try to tighten their belt.  While
44      * the exact point at which this will be called is not defined, generally
45      * it will happen around the time all background process have been killed,
46      * that is before reaching the point of killing processes hosting
47      * service and foreground UI that we would like to avoid killing.
48      *
49      * <p>Applications that want to be nice can implement this method to release
50      * any caches or other unnecessary resources they may be holding on to.
51      * The system will perform a gc for you after returning from this method.
52      */
onLowMemory()53     void onLowMemory();
54 }
55