jchristof
jchristof

Reputation: 2834

Java generics in inheritance in Android

My intention is to set create a class with this type of inheritance:

public class BaseActivity<T> extends <T extends Activity> 

but of course this inheritance syntax doesn't compile. Any alternative suggestion where I can arbitrarily select a Tab or Map Activity to be the base of other Activity classes whose override behavior is necessary?

Upvotes: 0

Views: 597

Answers (1)

Sean Owen
Sean Owen

Reputation: 66886

You can't do that, but you can do:

public class BaseActivity<T extends Activity> extends Activity

That's not exactly what I think you mean to express, but perhaps close?

Upvotes: 1

Related Questions