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

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -