# Adding a second Activity

Hopefully, nothing new here&#x20;

We create a new `DetailActivity.kt` and we add a companion object for the new intents.&#x20;

{% hint style="warning" %}
It's always advisable to use the wizard for creating new activities (right click anywhere on your project panel and select New>Activity>Empty Activity). If you don't create the Activity from the wizard don't forget to add it to your Manifest.
{% endhint %}

{% code title="DetailActivity.kt" %}

```
companion object {

    private val INTENT_CONTACT_AVATAR = "contact_avatar"

    private val INTENT_CONTACT_NAME = "contact_name"
    private val INTENT_CONTACT_PHONE = "contact_phone"

    fun newIntent(context: Context, contact: Contact): Intent {
        val intent = Intent(context, DetailActivity::class.java)
        intent.putExtra(INTENT_CONTACT_AVATAR, contact.avatarId)
        intent.putExtra(INTENT_CONTACT_NAME, contact.name)
        intent.putExtra(INTENT_CONTACT_PHONE, contact.phone)
        return intent
    }
}
```

{% endcode %}

and we add some views to our XML layout file:

{% code title="activity\_detail.xml" %}

```
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".DetailActivity">

    <de.hdodenhof.circleimageview.CircleImageView
        android:id="@+id/iv_avatar"
        android:layout_width="150dp"
        android:layout_height="150dp"
        android:layout_marginTop="52dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:civ_border_width="7dp"
        app:civ_border_overlay="true"
        app:civ_border_color="#FFFFFF"
        tools:src="@tools:sample/avatars" />

    <TextView
        android:id="@+id/tv_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="48dp"
        android:textColor="@color/text_accent"
        android:textAppearance="@style/TextAppearance.AppCompat.Headline"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.501"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="@+id/view"
        tools:text="@tools:sample/full_names" />

    <View
        android:id="@+id/view"
        android:layout_width="wrap_content"
        android:layout_height="0dp"
        android:background="@color/colorBg"
        android:elevation="-1dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="@+id/guideline_horizontal25" />

    <android.support.constraint.Guideline
        android:id="@+id/guideline_horizontal25"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        app:layout_constraintGuide_percent="0.25" />

</android.support.constraint.ConstraintLayout>

```

{% endcode %}

{% hint style="info" %}
In order to test it on a real device we need of course to start the activity first from our MainActivity, but we're going to explain this to the next step. If you want to test it anyway, the easiest way is to set it as a launcher activity from the Manifest instead of the MainActivity.&#x20;

**DON'T FORGET TO CHANGE IT BACK** after you finish this step!&#x20;
{% endhint %}

![Details screen](https://720760333-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LMI4Smg5kqkZcFtc7nH%2F-LNN42yKHFR2cVVmYbRf%2F-LNN62BuoNYz3GWiIs05%2Fimage.png?alt=media\&token=2a782eba-5a40-4e95-a799-3269ced8603a)
