Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android Basics: Viewmodel and State in Compose #220

Open
Annateranna opened this issue Oct 19, 2024 · 0 comments
Open

Android Basics: Viewmodel and State in Compose #220

Annateranna opened this issue Oct 19, 2024 · 0 comments

Comments

@Annateranna
Copy link

Section:
9. Handle last round of game
In the code snippet:

import com.example.android.unscramble.data.MAX_NO_OF_WORDS


private fun updateGameState(updatedScore: Int) {
   if (usedWords.size == MAX_NO_OF_WORDS){
       //Last round in the game
   } else{
       // Normal round in the game
       _uiState.update { currentState ->
           currentState.copy(
               isGuessedWordWrong = false,
               currentScrambledWord = pickRandomWordAndShuffle(),
               currentWordCount = currentState.currentWordCount.inc(),
               score = updatedScore
           )
       }
   }
}

The "android" should not be in the path. The path should be "import com.example.unscramble.data.MAX_NO_OF_WORDS"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant