java - Passing & Adding two numbers using Parse Cloud code? -


ive got parse sdk set up, , "hello world!" function runs fine. im trying send 2 int's (i1 & i2) , return sum. need know is:

1) how send variables

2) how receive them. changing hashmap hashmap<string,object> hashmap<integer,object> gives error

parsecloud function (js)

parse.cloud.define("add", function(request,response) { var inta = 1; var intb = 2; var intc = inta + intb;  //var s = "hello add!"; //response.success(s); response.success(intc); }); 

android method, doaddition()

    s1 = et1.gettext().tostring();     s2 = et2.gettext().tostring();      i1 = integer.parseint(s1);     i2 = integer.parseint(s2);      parsecloud.callfunctioninbackground("add",  new hashmap<integer, object>(), new functioncallback<integer>()      {         @override         public void done(integer sum, parseexception e)          {             s3 = sum.tostring();             et3.settext(s3);         }     }); 

the above android-method gives error:

 method callfunctioninbackground(string, map<string,?>,  functioncallback<t>) in type parsecloud not applicable  arguments (string, hashmap<integer,object>, new  functioncallback<integer>(){}) 

set args correctly before call cloudfunction ( proper javascript parms ) them in cloud funct...

  var matharg1 = request.params.arg1;   var matharg2 = request.params.arg2; 

create result field in js...

  var mathresult = matharg1 + matharg2; 

return result client json ( used in cloud interfaces! )

success: function(user) {     response.success(mathresult.tojson()); }, 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -