java - How can I query a specific column value in a Parse.com class and set it to a string? -


how can query specific value of object in parse class , set string? given have object specific objectid, want value "position" column, , want set string.

    parsequery<parseobject> query = new parsequery<parseobject>("nativead");     query.whereequalto("objectid", "fybeufqdot");     query.findinbackground(new findcallback() {          @override         public void done(list objects, parseexception e) {             if (e == null) {                 log.d("nativead", "retrieved " + objects.size());                 (parseobject adposition : objects) {                     string n = adposition.get("position").tostring();                     system.out.println(n);                 }             } else {                 log.d("nativead", "error: " + e.getmessage());             }         }      }); 

i think work

@override public int getviewtype(int position) { parsequery<parseobject> query = new parsequery<parseobject>("nativead"); query.whereequalto("objectid", "fybeufqdot"); final string[] n =  new string[1];  query.getfirstinbackground(new getcallback() {     @override     public void done(parseobject object, parseexception e) {          n[0] = object.tostring();     } });  int viewtype = view_type_market_feed; if ((position % n[0] == 0) && position > 0) {     viewtype = view_type_ad; } return viewtype; 

}

now answers questions : n declared in getcallback anonymous class hence n has scope class only.


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -