--
You received this message because you are subscribed to the Google Groups "roboguice" group.
To view this discussion on the web visit https://groups.google.com/d/msg/roboguice/-/HtoYEUN9KDQJ.
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.
On Oct 20, 2:07 am, Michael Burton <m...@niskala.org> wrote:
> Done, thanks for the contribution! You can check it out in the latest snapshot. I had to make a small change to only perform the binding on API level 5 or above.
>
> Cheers,
> Mike
>
> --http://about.me/michaelburton
>
> On Oct 19, 2011, at 11:14 PM, Roberto Tyley wrote:
>
>
>
>
>
>
>
>
>
> > Hi there, hope you can accept this patch which adds a default binding for android.accounts.AccountManager:
>
> >https://code.google.com/r/robertotyley-roboguice/source/detail?r=8d37...
>
> >http://developer.android.com/reference/android/accounts/AccountManage...
>
> > cheers,
> > Roberto
>
> > --
> > You received this message because you are subscribed to the Google Groups "roboguice" group.
> > To view this discussion on the web visithttps://groups.google.com/d/msg/roboguice/-/HtoYEUN9KDQJ.
Oops. So, if you ever want to do late binding when a class may or may
not be available based on an API version, you can NEVER refer to that
class as <class>.class, even if you wrap it in an 'if' statement.
Right now, any time the DefaultRoboModule class is loaded, it will
crash on SDK<5 because you're directly referring to
AccountManager.class.
"Android’s 1.6 classloader is an over-eager know-it-all. It seeks out and checks every method call present in your loaded (key word!) classes. This means that even if you’ve blocked out a section in a check againstBuild.VERSION.SDK_INT, Android 1.6 will check every method inside."
Similarly, it will crash if the fragment
manager compatibility is not included because you directly reference
FragementManager.class. You can't even refer directly to
FragmentManagereProvider.class and AccountManagerProvider.class
because loading those classes will cause the FragmentManager and
AccountManager classes to be loaded. You have to refer to all of
these classes with Class.forName. I'll log a bug report.