I'd like to use the libraries mentioned in the title in one project.
However, both need my Activities to extend from a special Activity class: in the case of Roboguice it's RoboAcitivity, and it's FragmentActivity for ActionbarSherlock.
ActionbarSherlock extends the compatibility library, which is nice, because I also need to use fragments, and the project level s < API level 11.
Has anyone succeeded in doing this? Since Java does not support multiple inheritance (which is a good thing usually), I tried to make the FragmentActivity in the ActionbarSherlock project to extend RoboActivity instead of the standard Activity. But I can't get it to compile this way.
Part of the console output is:
[2011-10-15 17:46:31 - RetainFragmentTest2] /Users/scythe/JavaLibs/JakeWharton-ActionBarSherlock-a4855d0/library/res/values-v11/abs__styles.xml:170: error: Error: No resource found that matches the given name: attr 'android:logo'.
[2011-10-15 17:46:31 - RetainFragmentTest2] /Users/scythe/JavaLibs/JakeWharton-ActionBarSherlock-a4855d0/library/res/values-v11/abs__styles.xml:171: error: Error: No resource found that matches the given name: attr 'android:navigationMode'.
[2011-10-15 17:46:31 - RetainFragmentTest2] /Users/scythe/JavaLibs/JakeWharton-ActionBarSherlock-a4855d0/library/res/values-v11/abs__styles.xml:174: error: Error: No resource found that matches the given name: attr 'android:progressBarPadding'.
[2011-10-15 17:46:31 - RetainFragmentTest2] /Users/scythe/JavaLibs/JakeWharton-ActionBarSherlock-a4855d0/library/res/values-v11/abs__styles.xml:176: error: Error: No resource found that matches the given name: attr 'android:subtitle'.
[2011-10-15 17:46:31 - RetainFragmentTest2] /Users/scythe/JavaLibs/JakeWharton-ActionBarSherlock-a4855d0/library/res/values-v11/abs__styles.xml:177: error: Error: No resource found that matches the given name: attr 'android:subtitleTextStyle'.
[2011-10-15 17:46:31 - RetainFragmentTest2] /Users/scythe/JavaLibs/JakeWharton-ActionBarSherlock-a4855d0/library/res/values-v11/abs__styles.xml:173: error: Error: No resource found that matches the given name: attr 'android:titleTextStyle'.
I'm sure there's a better way, but this is how I finally got ActionBarSherlock and RoboGuice working in my little app.
I would just like to add that by 'simply' adding roboguice-sherlock to your maven pom it magicly works.
<dependency>
<groupId>com.github.rtyley</groupId>
<artifactId>roboguice-sherlock</artifactId>
<version>1.5</version>
</dependency>
Besides the issues with the compatibility library, you might also struggle with how to extend your activity both from RoboActivity
and SherlockActivity
- in Java, you don't have mulitple inheritance :-)
The way you solve this is by hand-crafting your own RoboSherlockActivity
or use
Roberto Tyley's library.
See example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With