ProgrammerGuide.Net | Step by Step Programmer Guide

Building an Intent | Android | ProgrammerGuide.Net | Step by Step Guide

An Intent object binds two activities (components) during runtime. An Intent is an app’s intention to do an action. In other words, an intent is an abstract description of an operation to be performed. Intent can be used with startActivity to launch another Activity.

Let’s create an Intent to start an activity called ShowMessageActivity.

Intent intent = new Intent(this, ShowMessageActivity.class);

The constructor of the Intent is called with two parameters of type Context and Class. Here, this is the Activity class passed as the first parameter. Activity class is a subclass of Context. Second parameter ShowMessageActivity.class, is the Class of the activity that should be started to which the system should deliver the Intent. Here, it is ShowMessageActivity.

Please click here for related products on Amazon!

Jayashee

Add comment

Want to Check Celebrities News?