Apply your knowledge to build something amazing!
Time needed: 45-60 minutes
Please watch this video to see how this app works.
Get ready to create the Shaky Picky app - your personal decision maker! Can't decide what to eat for lunch? Not sure which game to play? Just add your choices to the list and shake your phone to let the app pick for you! It's like having a magic 8-ball that actually gives you real answers!
By the end of this project, you'll be able to:
Here are some fun ways kids have used Shaky Picky:
The sample UI of the app and components that you will be using to make the app:
Sample UI | Components You'll Need |
---|---|
![]() |
Layout Components: • Vertical Arrangement • Horizontal Arrangement Visible Components: • Labels • Image • List Picker ![]() |
Here's what Shaky Picky looks like after users saved some items into the list and after they shook their phones:
After users saved some items in the list | After users shook their phones |
---|---|
![]() |
![]() |
:bulb: Pro Tip: This app needs only 1 screen - keep it simple!
Ready to make some magic happen? Let's program your Shaky Picky app step by step!
First, we need a place to store all the choices users will add. Think of it like creating an invisible basket to hold everything!
Make a global variable (name it as myList), and create an empty list.
:dart: Quick Hint: You only need 2 blocks for this!
:emoji: Stuck? Look for the "initialize global" block and the "create empty list" block!
Time to bring the Save button to life! This is where users will add their choices to the list.
Program what happens when the Save button is clicked:
Check if the textbox is empty:
If the textbox has text:
:dart: Super Smart Tip: Make your app extra clever! Program it to ignore spaces, so if someone accidentally types just spaces, it knows the box is still empty!
:emoji: Stuck? Use the "trim" block to remove extra spaces!
Your app should have a great memory! When users open the app, it should remember all their saved choices from before.
Program your app to:
:dart: Why this matters: Imagine adding 10 favorite foods, closing the app, and losing them all! That would be sad. TinyDB is like your app's memory bank!
Nobody likes accidentally deleting their favorite choice! Let's add a confirmation message to keep things safe.
Here's how it works:
Program the app to show this confirmation AFTER the users pick an item from the list picker:
Make it personal! The message changes based on what they selected:
:dart: Coding Tip: Use the
block to combine "Are you sure you want to delete " with the selected item!
:emoji: Stuck? The join block lets you stick text together like: "Are you sure..." + selected item + "?"
Now let's make the delete button actually work! Program what happens AFTER users choose "Yes" from the confirmation box.
Your app should:
:bulb: Good News: If they choose "No", the app automatically closes the dialog - no extra coding needed!
:dart: Make it friendly: Instead of just deleting silently, telling users "Pizza has been deleted" confirms their action worked!
This is the most exciting part - making your phone respond to shaking! The Accelerometer Sensor will detect when someone shakes their phone.
Program what happens when the user shakes their phone:
If the list is empty:
If the list has items:
:dart: Cool Factor: The Text-to-Speech makes your app feel like it has a voice! Your friends will be amazed when the phone actually tells them what was picked!
:emoji: Stuck? Use the "pick random item from list" block to get a random choice!
You've just built an amazing decision-making app! Your Shaky Picky can:
Now it's time to make your Shaky Picky unique:
Ready for an extra challenge? Watch this video to see the super-powered version of Shaky Picky!
"Clear All" Button :emoji:️
No Repeats Mode :dart:
Magic Reset :sparkles:
:trophy: Challenge Accepted? These features will make your app even more awesome! Try adding one at a time and test as you go.
Amazing work! You've created a real, working mobile app that:
What's Next?
Keep coding and keep creating! :rocket: