java - How to access public variables declared in an Activity class from another class in android -


i have public variables define in activity class:

public class rentlistingfeed extends actionbaractivity {      private parsequeryadapter<parseobject> mainadapter;     private customadapter rexovoadapter;     private listview listview;      public string typequery;     public string bedquery;     public string toiletquery;     public string condquery;     public string availquery;     public string intentionquery;      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_rent_listing_feed);           typequery=getintent().getstringextra("type");         bedquery=getintent().getstringextra("beds");         toiletquery=getintent().getstringextra("toilets");         condquery=getintent().getstringextra("condition");         availquery=getintent().getstringextra("availability");         intentionquery=getintent().getstringextra("intention"); 

as can see, these variable getting values activity.

how can access these variable in separate class?

my separate class:

public class customadapter extends parsequeryadapter<parseobject> {      public customadapter(context context) {         // use queryfactory construct pqa show         // todos marked high-pri         super(context, new queryfactory<parseobject>() {             public parsequery create() {                 parsequery query = new parsequery("propertydetails");                 query.whereequalto("tag", "property");                 query.whereequalto("type","");                 return query;             }         });     } 

in class, have assign these variables :

query.whereequalto("type",""); 

how can that?

thanks , regards

declare them static

public static string typequery; 

now can use them in other class

rentlistingfeed.typequery 

Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -