Sometimes you want to modify some of the defaults that appear in the chooser, like when you’re sharing a text or image to any other android app that can accept text or images. The most common use case for this is when users press the “Share” button in your app. To create the custom chooser, you use the ShareCompat.IntentBuilder class. String title = "Share weather details"; String mimeType = "text/plain"; String shareText = "I want to share this string"; Intent intent = ShareCompat.
An image is worth a 1000 words. Source That image generally sums up the main beats of the Android Activity lifecycle. Knowing the lifecycle allows you to think about what your application should do as it goes through this lifecycle. What information you need to save to ensure the user has a consistent experience? I’d really like to see how Twitter handles the lifecycle on it’s timeline activity. I admire how well, even when the app crashes, it’s able to maintain the exact position I was in on my twitter feed.
Intents are a kind of messaging system used by Android activities to pass information back and forth. It helps keep a separation of concerns between activities. There are two main types of intents: explicit and implicit. Explicit intents are best used between activities within your own application, since they require the full class name in order for them to be started. Here’s an example of starting an explicit intent. This would appear in an Activity class: