KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm slowly working through an Android learning book and was given the following code to assign user data: package com.androidbook.triviaquiz; import android.app.Activity; import android.content.SharedPreferences; public class QuizActivity extends Activity { public static final String GAME_PREFERENCES = "GamePrefs"; SharedPreferences settings = getSharedPreferences(GAME_PREFERENCES, MODE_PRIVATE); SharedPreferences.Editor prefEditor = settings.edit(); prefeditor.putString("UserName", "John Doe"); //**syntax error on tokens** prefEditor.putInt("UserAge", 22); //**syntax error on tokens** prefEditor.commit(); } However, I get an error (lines indicated with comments) that underlines the period and says "misplaced construct" and also that underlines the arguments saying "delete these tokens". I have seen this done in other applications in the same format, I don't understand what is wrong.
Tags (comma-separated)
Save Edits
Cancel