This website collects cookies to deliver better user experience
Browsing Jetpack Compose samples
Browsing Jetpack Compose samples
Problem
While writing apps with Jetpack Compose you can always Cmd+Click on a library function to check their sources and comments. And often you can find a link to the sample code with an example of usages for that function. Unfortunately, sample code is not published together with the Jetpack Compose library so you cannot browse them.
Jetpack Compose has two kinds of samples. The API samples - small examples of api usages, and sample apps repo on github. In this post we're talking about API samples.
Easy Solution
All Jetpack Compose sources are open and published as a part of the AndroidX repo. We can quickly find sample code using Android Code Search website.
Keeping a browser tab open and manually copying function name is quite a hassle. We can do better, we can automate it! And CodeSearch plugin can help us with that. It allows us to launch search queries right from the IDE, and we can add a custom search engine.