Rahmad Setiawan M
2 min readMar 27, 2019

--

Activity and Intent Part 1

Assalamu’alaikum,

Activity is an application component that represents one window that typically fills the screen, like a page.

To Create an Activity, you can click File → New → Activity → Empty Activity.

When you create a new activity, there have 2 items and 1 line code that generated:

1. Layout items (activity_main2.xml)

2. Function items (Main2Activity.java)

3. Properties in (AndroidManifest.xml)

Here is the line code inside AndroidManifest.xml :

Okay, after the new activity or new page is created, you can navigate the first page to another page with Intent, so lets code for the navigation with intent:

  1. Create new instance of intent: Intent activityname = new Intent(SourcePage.this, DestinationPage.class)
  2. Apply the navigation and changing the activity with startActivity(activityname)
  3. This is the real implementation code:

When you navigate from source activity to another activity or page, you can bring the data too using put extra and receive the data in destination activity or page.

Sending the data from source activity:

Receive the data in destination activity:

Okay, well this is the basis of navigation and passing the data between two activities, next we will continue with part two.

Wassalamu’alaikum.

My Android Development Stories:

  1. What is Android Studio
  2. Designing your Android Apps
  3. Activity Intent Part 1 (You are Here)
  4. Activity Intent Part 2
  5. Android Menu

--

--

Rahmad Setiawan M

Android Software Engineer. Dear my future children, I hope you can learn from my story, be better than your father in your way, happy reading ❤️