Android: How to extends my Activity class with RoboActivity + ActionBarActivity
Asked Answered
N

2

5

I would like to use RoboActivity with my activity, but I don't know how to do that coz my current activity extends already ActionBarActivity:

public class MainActivity extends ActionBarActivity 

Thank you so much

Nealneala answered 23/3, 2014 at 14:47 Comment(3)
Extend RoboActivity from ActionBarActivity then MainActivity extends from RoboActivity.Ab
RoboActivity class and ActionBarActivity class are librairies class, not mine!Nealneala
Then it is not possible in Java. You cannot extend class from multiple classes.Ab
P
6

For RoboGuice 3 simply extend from RoboActionBarActivity.

Positive answered 8/2, 2015 at 0:54 Comment(0)
W
3

You can simply copy the relevant RoboActivity parts into your subclass of ActionBarActivity. From the official docs https://github.com/roboguice/roboguice/wiki/Using-your-own-BaseActivity-with-RoboGuice:

In case your base activity class already extends a different library, the best way to get all the power of RoboGuice is to copy all the code contained in RoboActivity.

An example is also provided therein.

Wineskin answered 12/7, 2014 at 20:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.