Image for post
Image for post
Illustration by Virginia Poltrack

Introducing Android Sunflower

A gardening app illustrating Android Jetpack development best practices

Tiem Song
Tiem Song
Aug 27, 2018 · 4 min read

(This article is also available in Chinese at WeChat / 中文版请参考 WeChat)

Google announced Android Jetpack at Google I/O 2018. Jetpack is a collection of Android software components to make it easier for you to develop great Android apps. These components help you follow best practices, free you from writing boilerplate code, and simplify complex tasks, so you can focus on the code you care about.

To help developers learn how to integrate Jetpack components into their own apps, we created Sunflower, a gardening app illustrating Android development best practices with Android Jetpack. If you’re new to Jetpack, it’s a good idea to check out the Jetpack content on developer.android.com and build your first simple, Jetpack-based app before continuing.

This article about Sunflower is the first in a series. It takes you on a tour of Sunflower and briefly explains which Jetpack components are included in the app. Future articles will discuss Jetpack and Android development and dive deeper into specific topics like Navigation and scheduling recurring tasks with WorkManager.

A quick garden tour

When the app is first launched, the user sees the “My Garden” screen, which is initially empty.

My Garden screen with an empty garden

Let’s add a plant! Navigate to a list of plants by tapping on the hamburger menu and opening the navigation drawer.

Plant list

Each plant is associated with a Grow Zone, which is determined by latitude and indicates the region best suited for the plant to thrive. You can filter the list of plants by tapping the filter menu item which selects a Grow Zone.

Tapping on a specific plant will navigate to the Plant Detail screen.

Plant details

The plant detail screen shows the plant’s name, description, watering needs, and a picture of the plant. The user can add the plant to their garden from this screen by tapping on the Floating Action Button. They can also Share the plant via the menu option.

After one or more plants are added, each new plant appears in the “My Garden” screen, along with the date it was planted and when it next needs to be watered. Let’s navigate back to “My Garden” to see the screen now that we’ve added a plant or two.

My garden with added plants

The “My Garden” screen now shows the added plants, along with the date they were planted and last watered.

Using Jetpack components

Sunflower uses many Jetpack components. Here’s a brief look at how each component plays its part:

Future improvements

Sunflower is currently released as an alpha and is undergoing heavy development, with new features and deeper component integrations landing regularly. Some of these upcoming improvements include filtering the plant list based on the user’s location, migrating to AndroidX, and notifying when a plant needs watering.

Create and vote for issues on GitHub that you’d like to see implemented or explored.

In future articles we’ll explore using other Jetpack components in Sunflower such as navigation and recurring tasks, so stay tuned. Thanks for reading!

Image for post
Image for post
A sunflower in a Google garden

Continue Exploring

Thanks to the wonderful individuals on the Android Developer Relations and Jetpack teams for their contributions to Sunflower and this article.

Android Developers

The official Android Developers publication on Medium

Tiem Song

Written by

Tiem Song

Dad, husband, Longhorn, cyclist. Android DevRel @ Google. Gardening is joyfully fighting a losing battle with squirrels.

Android Developers

The official Android Developers publication on Medium

Tiem Song

Written by

Tiem Song

Dad, husband, Longhorn, cyclist. Android DevRel @ Google. Gardening is joyfully fighting a losing battle with squirrels.

Android Developers

The official Android Developers publication on Medium

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store