Android Routing

When it comes to programming, the term routing is more commonly used in web development. In that field of study it refers to the process of determining when a user visits a page by making a HTTP request.

Here is a simple example of a route in web development:


Route::get('/hello', function () { 
    return 'Hello There';


However in android when we talk about routing we simply mean navigation. Android apps are client-side software therefore do not receive HTTP requests like web servers. But we typically need to navigate between activities and fragments.

We typically do these via intents and pass data via bundles. However developers have been creating libraries to make this navigation easier and more intuitive. These libraries are what we call routing libraries and it is the aim of this thread to discuss them.

If you’ve come across any library or example please feel free to contribute it here.


Related Concepts


1 Example

  1. Linker

    Linker is a library written in Kotlin that provides an annotation-based API to handle URI routing for Android. Linker provides not only simple navigation but the ability to query a Uri.

    Here is how it’s used:

    Step 1.

    The first step is to install the library:


    dependencies {
        api 'me.twocities:linker:0.0.5'
        kapt 'me.twocities:linker-compiler:0.0.5'


    There are two parts of Linker:

    (a). Annotations

    With annotations:

    You can use @link to indicate the Uri that was requested.


    class ProductActivity: AppCompatActivity {


    Then @LinkPath@LinkQuery for parameters


    class ProductActivity: AppCompatActivity {
      @LinkPath("id") lateinit var productId: String
      @LinkQuery("title") lateinit var productTitle: String



    (b). LinkResolver

    Here is how LinkResolve is defined:


    interface LinkResolver {
      fun resolve(link: String): Result


    Function resolve will parse the given link, and then return a Result, which has a nullable property of Intent, it will be null if no responding activities was found,



    val result = resolver.resolve("link//product/detail/123")
    if (result.success()) startActivity(result.intent)



    Here are the links:

    1. Find full example here.
    2. Read more about this library here.
    3. Follow the author here.

Share an Example

Share an Example

What is the capital of Egypt? ( Cairo )