androidengineers.Book a session

State ownership and screen actions

Practice: PocketChat Compose state

exerciseSelf-paced

Assignment: prove draft ownership

Start with no configured key. Create a chat, type “Explain cancellation,” and tap Send. Expect a setup notice and an unchanged draft. Entering a key is not required for this exercise.

Read ChatViewModel.send() and locate the Boolean return from ChatRepository.send(). Explain why clearing the draft unconditionally would lose input on a missing-key or busy-request failure.

Run the isolated device tests on an emulator that does not contain your personal app data:

./gradlew :app:connectedDebugAndroidTest

RotationTest recreates the actual Activity; ChatJourneyTest uses controlled model responses. Neither proves process-death behavior of a live network call. Manually type a draft, return to Chats, reopen that conversation, and verify its text. Then recreate the Activity and compare.

Submit the state-owner diagram and results for missing credentials, switching conversations, Activity recreation, and keyboard-plus-snackbar interaction. If a UI assertion passes but a normal tap does nothing, inspect overlapping layout bounds before changing repository logic.

Study guide · Hands-on codelab · Pinned Android source

YOUR LEARNING JOURNEY

0 of 23 available lessons completed

Progress saved in this browser. No account needed.
Practice: PocketChat Compose state | Gemini Chat for Android with PocketChat | Android Engineers