Xml based bean creation possible wiht RoboGuice?

44 Views Asked by At

I want to define beans into xml file and want to inject it using RoboGuice in android app, is it possible with RoboGuice?

1

There are 1 best solutions below

0
On

I believe, the answer is NO.


Though you can inject objects of simple types. A simple example:

Place this in your res/values folder:

<resources>
    <item name="flag" type="bool">false</item>
</resources>

And this in your res/values-land folder:

<resources>
    <item name="flag" type="bool">true</item>
</resources>

In your activity:

@InjectResource(R.bool.flag) private Boolean flag;

Now you can use flag to determine whether device is in landscape mode.