当我的用户玩游戏时,我想将他们锁定30秒钟。我正在尝试使用SharedPreferences
。我对SP不太熟悉,也不完全知道如何使用它。所以应该看起来像这样
ifGameOver(){
//lock the game for 30 seconds
//send users to main menu until 30seconds is over
}
Run Code Online (Sandbox Code Playgroud)
然后在主菜单上,我希望能够随着30秒的下降而看到TextView的计数。所以在这里我会getLong
或某事(?)。谁能对此有所启示?
我希望能够将9245除以1000并得到9.245,然后将此数字推送到我的textview中。
我的代码给了我9.0,而不是其余的。希望我保留其余的吗?
String playerScore1 = gameInfo.getGame_time() / 1000;
playerscore1.setText(Double.toString(playerScore1));
Run Code Online (Sandbox Code Playgroud)