Assisted Inject

224 views
Skip to first unread message

Adam Tybor

unread,
Dec 30, 2010, 7:26:59 PM12/30/10
to robo...@googlegroups.com
Just an FYI, the assisted inject extension works with robo on android.  I wish I new about this one before.  Sure beats all those crazy providers I have been rolling.

Cheers,
Adam

Michael Burton

unread,
Dec 30, 2010, 8:58:27 PM12/30/10
to robo...@googlegroups.com, robo...@googlegroups.com
Neat! I always assumed that assisted inject used codegen or aop and wouldn't work with android

What are you using it for out of curiosity?

Sent from my iPad
--
You received this message because you are subscribed to the Google Groups "roboguice" group.
To post to this group, send email to robo...@googlegroups.com.
To unsubscribe from this group, send email to roboguice+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/roboguice?hl=en.

Adam Tybor

unread,
Dec 30, 2010, 9:09:35 PM12/30/10
to robo...@googlegroups.com
public SpinnerCursorAdapter(Activity context, @Assisted CursorProvider cursorProvider, @Assisted String textColumn) {
 // ...
}

public interface SpinnerCursorAdapterFactory {
        public SpinnerCursorAdapter create(CursorProvider cursorProvider, String textColumn);
    }

I inject this guy into my activity and then when I need a spinner its just

spinner.setAdapter(adapterFactory.create(new CursorProvider() {
  Cursor get() {
    return db.findAllColors();
  }, DatabaseHelper.Columns.Color);

I have a lot of spinners and they are all actually dependent on each other so I built a custom adapter to handle all the query changes and cursor switches asynchronously.

Adam
Reply all
Reply to author
Forward
0 new messages