我在上面的图片中向您展示。 Firebase的“用户”选项卡下有一个“点”选项卡。我希望在周末重置“点”。用Java(android studio)编写的应用程序。我共享个人资料文件中的代码
FloatingActionButton backBtn = view.findViewById(R.id.backBtn);
pointTv = view.findViewById(R.id.pointTv);
goldNumTv = view.findViewById(R.id.goldNumTv);
userNameTv = view.findViewById(R.id.userNameTv);
getMoreGoldBtn = view.findViewById(R.id.get_more_gold);
bnp = view.findViewById(R.id.quizSuccessPercentage);
getMoreGoldBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showBuyDialog();
}
});
backBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
pop();
}
});
private void getProfile() {
int questionSize = 0;
int trueCount = 0;
Glide.with(_mActivity)
.load(currentUser.getPhotoUrl())
.into(mChooseImage);
pointTv.setText(currentUser.getPoint()+"");
goldNumTv.setText(currentUser.getGoldNum()+"");
userNameTv.setText(currentUser.getName());
if (!currentUser.getGames().isEmpty()){
Iterator it = currentUser.getGames().entrySet().iterator();
while (it.hasNext()) {
Map.Entry pair = (Map.Entry)it.next();
//System.out.println(pair.getKey() + " = " + );
Game game = (Game) pair.getValue();
questionSize = questionSize + game.getQuestionSize();
trueCount = trueCount + game.getTrueCount();
it.remove(); // avoids a ConcurrentModificationException
}
int percentage = (trueCount * 100) / questionSize;
bnp.setProgress(percentage);
}
}