I am developing an application which contain 2 Tab with Fragment.each Tab class AssetsMapFragment
and AssetsListFragment
Extends with SherlockFragment
class, now i need to extends MapActivity in this both Tab Class but according to Java Multiple Inheritance are not supported. and there are another solution with Interface,that i can make interface and implement with it.but my MapActivity is not interface so i cant able to do that. so can you please give some alternate solution for this situation that what i do to use both class in one class ?thats great help for me.thanks.
Asked
Active
Viewed 98 times
0

user123
- 128
- 1
- 9
-
May be you are looking for adapter pattern... – om39a Nov 30 '12 at 05:53
-
Please check http://stackoverflow.com/a/11341748/1321873 – Rajesh Nov 30 '12 at 05:58
-
1If your talking about google apis MapActivity, it doesn't support fragments. – k_shil Nov 30 '12 at 05:58
-
@Zzokk I am Not use Google Map ,I am Use Mapsforge Opensource library – user123 Nov 30 '12 at 06:00
1 Answers
0
If possible try like this
public class a {
public static String a="This is a";
public static void aDisplay()
{
System.out.println(a);
}
}
public class b {
public static String b="This is b";
public static void bDisplay()
{
System.out.println(b);
}
}
public class c extends a {
public static class d extends b{
public static void main(String args[]){
aDisplay();
bDisplay();
}
}
}
Using Inner Class concept we can solve the problem. Or in the other way you have to follow Multilevel Inheritance only.

eshwar
- 1,763
- 1
- 18
- 26
-
-
class e extends c{ public static class f extends MapActivity{ //Your code Here //You can access mapActivity here, without creating instance //This class e contains all the properties of a,b and MapActivity //This is similar to multiple inheritance } } – eshwar Dec 20 '12 at 06:42