How to create Android Contact Book App : Part 5 : Viewing Contact Details using Explicit Intent

In this part we are going to learn, how we can view contact details.


Table of Contents

  1. Creating Contact Details Activity
  2. Setting Click Listener to ListView Item
  3. Sending Data to Contact Details Activity using Intent
  4. Retrieving Data into Contact Details Activity
  5. Download Source

  6. Creating Contact Details Activity

    In the Part 1 we have already created Layout to View Contact Details, Now open project from previous part to continue.
    Right click on src/New/Class and create new activity named “ContactDetails.java”. Once create the activity set the Layout for Activity.

    Now register activity into AndroidMenifest.xml

    ContactDetails

    Setting Click Listener to ListView Item

    Open Main.java. In this Activity we are going to assign onClickListener() to ListView Item. So when we will click on any specific Item of the Contact if will fire Click Event and After click we can jump to Contact Details Activity with Contact Details.

    Sending Data to Contact Details Activity using Explicit Intent

    Android supports two types of Intent. One is Implicit Intent and another is Explicit Intent. To know more about Intents, Visit link.
    In this example we are going to use Explicit Intent to send the data one activity to targeted activity.

    Retrieving Data into Contact Details Activity

    Now in the Contact Details we have to retrieve the data sent from Main activity and display it on Layout.

    ContactDetails_with_Data

1 reply

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *