mirror of https://github.com/tasks/tasks
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
952 B
Java
47 lines
952 B
Java
15 years ago
|
/**
|
||
|
* See the file "LICENSE" for the full license governing this code.
|
||
|
*/
|
||
|
package com.todoroo.andlib.service;
|
||
|
|
||
|
import android.content.Context;
|
||
|
|
||
|
/**
|
||
|
* Singleton class to manage current application context
|
||
|
* b
|
||
|
* @author Tim Su <tim@todoroo.com>
|
||
|
*
|
||
|
*/
|
||
|
public final class ContextManager {
|
||
|
|
||
|
/**
|
||
|
* Global application context
|
||
|
*/
|
||
|
private static Context context = null;
|
||
|
|
||
|
/**
|
||
|
* Sets the global context
|
||
|
* @param context
|
||
|
*/
|
||
|
public static void setContext(Context context) {
|
||
|
ContextManager.context = context;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Gets the global context
|
||
|
*/
|
||
|
public static Context getContext() {
|
||
|
return context;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Convenience method to read a string from the resources
|
||
|
*
|
||
|
* @param resid
|
||
|
* @param parameters
|
||
|
* @return
|
||
|
*/
|
||
|
public static String getString(int resId, Object... formatArgs) {
|
||
|
return context.getString(resId, formatArgs);
|
||
|
}
|
||
|
}
|