Unit 2 Pathway 3: UI and state¶ Understanding state in Compose Intro to tip calculator Intro to state in Compose Before you begin Prerequisites What you’ll learn What you’ll build What you’ll need Get started Starter code Starter app overview Starter code walk through Take input from the user Use state in Compose The Composition Use remember to save state State and recomposition in action Modify the appearance Display the tip amount Use the calculateTip() function Show the calculated tip amount State hoisting Stateful versus stateless composables Positional formatting Solution code Conclusion Calculate a custom tip Before you begin Prerequisites What you’ll learn What you’ll build What you’ll need Starter code Starter app overview Run the Tip Time App Add necessary string resources Add a tip-percentage text field Set an action button Add a switch Update calculateTip() to round the tip Add support for landscape orientation Solution code Conclusion Write automated tests Before you begin Prerequisites What you’ll learn What you’ll build What you’ll need Starter code Automated tests Why automated tests are important Types of automated tests Local tests Instrumentation tests Write a local test Prepare the app code Create the test directory Create the test class: local test Write the local test Run the local test Write an instrumentation test Create the instrumentation directory Create the test class: instrumentation test Write the instrumentation test Run the instrumentation test Solution code Conclusion Project: Create an Art Space app Before you begin Build static UI with composables Create a low-fidelity prototype Convert design into code Make the app interactive Determine user interaction Create states for dynamic elements Write conditional logic for interaction