I try to compare the result of an asynchronous function as below:
WritableMap res;
res = ServerAuthenticate.signIn(userName, userPass);
Log.d(TAG, " --> res.getString(status).length(): " + res.getString("status").length());
Log.d(TAG, " --> res.getString(status): " + res.getString("status"));
Log.d(TAG, " --> res.getString('status') == 'OK': " + (res.getString("status") == "OK"));
The code of above gives the following console outputs:
D/!NativeModules( 5899): --> res.getString(status).length(): 2
D/!NativeModules( 5899): --> res.getString(status): OK
D/!NativeModules( 5899): --> res.getString('status') == 'OK': false
res.getString("status")
value is OK
string but when I put it to a comparison as res.getString("status") == "OK"
it returns false
. Actually I use the method of results.putString("status", "OK");
in ServerAuthenticate.signIn()
function.
I wonder if is there any way to compare a property value of a WritableMap
?