You can replace all you static fields with a "Context" object which you can pass around or make a Singleton. It is possible to remove almost all your static fields away. Whether this is a good idea or not is up to you, but I wouldn't assume that it has to be much harder to use instance fields.
BTW: I would suggest
- placing static fields/constant with the class or package which uses them
- treat static arrays as immutable if possible making them
final as well.
You can use a non-static Context with
public class Context {
public static final String PREF_UTILITY_FILE_NAME = "PrefUtilityFile";
public Facebook fb;
public AsyncFacebookRunner fbAsyncRunner;
public String[] fbPermissions = {"email", "read_stream", "user_birthday"};
public SharedPreferences prefs;
public Editor editor;
public String access_token;
public long expires;
}
// pass to constructor as required
class UsesContext {
final Context context;
public UsesContext(Context context) {
this.context = context;
}
public void method() {
// can use context
}
}
This allows you to create unit tests with multiple Contexts.
The only thing I would leave static are constants.