I'm using RoboGuice for the first time in a project and am trying to inject a static variable but the variable is remaining null. Here is a quick mockup of something I'm testing:
public class MyActivity extends RoboFragmentActivity {
@Override protected void onCreate(Bundle savedInstanceState) {
MyObject.print();
}
}
@ContextSingleton
public class MyObject {
@Inject static AssetManager sAssetManager;
public static void print() {
if(sAssetManager == null) {
Log.d("debug", "AssestManager is null");
} else {
Log.d("debug", "AssetManager was injected");
}
}
}
How can I make this work ?
READ
I know this is not best practice - this is more a learning exercise in terms of using RoboGuice. Only answer if you have answer to the question given, not "Why are you doing this".