android - How to pass the class type -
i trying remake 1 library.i need pass class type object, , cast variable type. trying
public class baseactivity extends fragmentactivity { class<? extends application> appclass; public void setappclass(class<? extends application> c) { appclass = c; } protected socialprovidermanager getsocialprovidermanager() { return ((appclass) getapplication()).getsocialprovidermanager(); } }
another class
public class gameapplication extends application { private socialprovidermanager socialprovidermanager; public socialprovidemanager getsocialprovidermanager() { return socialprovidermanager } @override public void oncreate() { super.oncreate(); baseactivity.setappclass(this); } }
how make construction work. thanks.
Comments
Post a Comment