Photo by Samuel Chenard on Unsplash

This article builds on top of the code created in part 1

Adding the next destination

Open up your nav_graph.xml file in the design view, click the “New Destination” button on the top left corner (highlighted in the screenshot above) and click “Create new destination”.

Goodbye navigation nightmares!

Photo by Samuel Chenard on Unsplash

Continuing in the theme of new ways of doing common things required of an Android dev I wanted to show some basic usage of the Jetpack Navigation libraries to develop a hypothetical onboarding flow that will also use a shared view model to share information between fragments and SafeArgs to provide basic information to destinations with type safety.

Let’s start by creating a new project with an empty activity:

Goodbye startActivityForResult()

Photo by Samuel Bryngelsson on Unsplash

As of AndroidX Activity 1.2.0-alpha02 and Fragment 1.3.0-alpha02, a new mechanism for requesting results from an activity or fragment is available to Android developers.

Instead of calling startActivityForResult() with a request code and listening for the potential result in onActivityResult(), we now simply use a contract which defines our input(s) and output(s) and how we want to handle the outputs when they come.

We can define our own contracts but thankfully some common scenarios are catered for ‘out of the box’. …

This is the beginning of what I hope will be a handful of useful articles for anyone working with Bitmaps on Android.

This is a bit of a silly (but a real) one to start with but it’s definitely worth checking what resources you have lying around in your /res folder, which particular drawable folder they are in and what size they are.

In a lot of cases you can put a high quality version of your image resource in the ‘drawable-xxhdpi’ or ‘drawable-xxxhdpi’ folder and let the Android operating system do it’s ‘magic’ and scale the image for you…

I wanted to document how I go about building AOSP because I regularly wipe my computer to install a new OS, try something out and then revert back to Ubuntu after awhile. Also, when I was doing this for the very first time I struggled to find good documentation on anything but the very basics.

N.B. In the past I built some ROMs for the Nexus 9 so that will be my goal here but the target device won’t have any bearing on the initial steps and only really comes into play in the final stages, so this should work…

Software developer, Northern Ireland

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