Android Intents using Library 

| Prashanth Gurunath | - @17_prashanth


The following blog was posted on Medium by Prashanth Gurunath, a Software Research Engineer at Influx.

In this tutorial, we will be learning to integrate our Android App with an Android Intent Library that will simplify the concept of Intents.

By using this library you can use any of the functionalities that’s present in it in a single line of code.

So let’s get started!

Expected Output:

Through our app, we want to implement the following functionalities using the Intent Library:

  1. Open a browser link that’s entered by the user
  2. Open Facebook, Amazon, Twitter on the Browser
  3. Dial a number that’s entered by the user
  4. Open and view the developer’s LinkedIn Profile ;)
  5. Search the meaning of a string/query that’s entered by the user

Create An Android Studio Project #

  1. Open Android Studio and click on File -> New -> New Project


Enter your application name as: Intent Project or Intent App (whatever you want)


Choose API 23 (Android 6.0 — Marshmallow or above for the Minimum SDK)


Now choose an empty activity.

Click on finish and you will have your application created.

Add the necessary dependencies #


Add: maven { url ‘’ } to the build file in repositories


ADD: *‘com.github.imprashanthguru:MyIntentApp:v1.3’** build.gradle(app) file*

‘com.github.imprashanthguru:MyIntentApp:v1.3’ — This is the Library Dependency that we are going to use. Make sure to add this in the build.gradle(app) file.

TIP: Make sure to do a proper gradle sync.

We are now done with adding the required dependencies.

XML Code #

  1. Open your activity_main.xml file. The default layout will be constraint layout. But we will be using LinearLayout.
  2. Create a LinearLayout with android:orientation=”vertical” (Your choice. The layout doesn’t matter tbh! )
  3. From the below screenshot, Add the list of buttons that are needed to implement our functionality. (Check the XML code for the same)


Add 6 buttons inside the Linear Layout.


With this, we have successfully created the XML layout.

TIP: Make sure to assign the XML ID’s to all buttons/views and as a convention, we use small casing for XML ID’s.


Type the following code in your


Create Button Objects for all the 6 buttons and make sure to use the findViewById function to map the XML ID’s of the Button views with their corresponding Java Object.


Use the button setOnClickListener to set the event handler.


Java code explanation #

Enter any string url of your choice to open that link in the browser. Ex:

String url = “”; MyIntent.from(MainActivity.this).openBrowser(url).show();

MainActivity.this denotes the context





Enter any string/query which you want to search
MyIntent.from(MainActivity.this).searchMeaning(“world cup 2019 schedule”).display();

Enter a number of your choice.

TIP: Have an EditText where the user can enter the browser link URL, the query to google and also the phone number.

So what have we done here? #

We have basically used libraries to perform intent actions and functionalities with lesser lines of code. Without the library, we have to write the code for this separately. And this can be easily injected into your app.
With this , we have successfully completed the tutorial.

If you have any questions, feel free to mail me at

Source Code:

Article was originally published on Medium:

Prashanth Gurunath is Software Research Engineer at Influx. Passionate about mobile app development especially on the Android platform, Prashanth has an engineering degree from SRM University. The above article was originally published on Medium.


Now read this

Balaji at Barcelona

Balaji (Source - Google Images) Hola! # CineEurope happened in Barcelona in June this year. This is a trade convention that promotes the social, cultural, and economic value of cinema in Europe and internationally. (If you are wondering... Continue →