4

It seems that roboguice can only inject views from the contentView defined in onCreate(...) of the activity. Outside onCreate(), for example, if I have my custom dialog, which has also a content view (e.g. dialog.setContentView(R.layout.dialog_layout);), how can I inject views from this dialog_layout in my activity? (I got null when I directly inject the dialog views in the activity)

sth
  • 222,467
  • 53
  • 283
  • 367
Mellon
  • 37,586
  • 78
  • 186
  • 264

2 Answers2

2

You can use RoboDialogFragment in RoboGuice 2.0

Helpa
  • 709
  • 1
  • 12
  • 23
2

Currently roboguice does not support injecting views for things like Dialogs or Adapters. The code to handle it is fairly straightforward and patches to the roboguice project are certainly welcome.

Here is a link to adding some support for adapters, doing something with a dialog should be fairly similar.

https://groups.google.com/d/topic/roboguice/dJqcGJTcTzs/discussion

abombss
  • 476
  • 4
  • 7