こんにちは、ゲームで 4 人のプレーヤーのスコアを示すスコアカードに取り組んでいます。ユーザーがボタンを押すと、新しい行が挿入されます。私はこれを行います:
private void makeTag(String P1Score, String P2Score, String P3Score, String P4Score, String slot)
{
// originalQuery will be null if we're modifying an existing search
String originalScore = SavedSlots.getString(slot, null);
// get a SharedPreferences.Editor to store new slot/scores
SharedPreferences.Editor preferencesEditor = SavedSlots.edit();
preferencesEditor.putString(slot, P1Score, P2Score, P3Score, P4Score); // to store
preferencesEditor.apply(); // store the updated preferences
putString
次に、次のように言ってエラーを表示します。
The method putString(String, String) in the type SharedPreferences.Editor is not
applicable for the arguments (String, String, String, String, String).
一度に2つの変数しか保存できないようですか? (つまり、スロットと P1Score)。
4 人のプレイヤーがいて、それぞれのスコアを保存したいのですが、どうすればよいですか?