well , normally I want to submit value as a double to my leaderboard in google play service but it says submit method is for "long value"
Games.Leaderboards.submitScore
void com.google.android.gms.games.leaderboard.Leaderboards.submitScore(GoogleApiClient arg0, String arg1, long arg2)
So how how can I submit double or float values?
For both a double
and a float
, you can just cast it over to a long
like this:
long arg2 = (long) yourDoubleOrFloat;
However, keep in mind that both a double
and a float
are unprecise, as they are floating point numbers. You may want to be using int
's.