Frage

I figured out how to inject non-UI-Elements (Android) into a testclass, using Robolectric and RoboGuice. Unfortunately I was not able to figure out how to inject Android-UI-Elements into a testclass.

Is this possible at the present state of development of RoboGuice and Robolectric?

If it is possible, can somebody give me a hint where to find a tutorial or offer some small code-example? If it is not possible right now a hint will be nice too.

Thanks

War es hilfreich?

Lösung

No this is not possible. The InjectView code only accepts one argument which serves as source and destination. So you can't Inject references of views from an activity into another object.

You can check the source for more information: https://github.com/roboguice/roboguice/blob/master/roboguice/src/main/java/roboguice/inject/ViewListener.java#L162

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top