What's the difference between activity and intent in Android?

In very simple language, Activity is your user interface and whatever you can do with a user interface. When you move from one user interface, you need to launch that new user interface with an Intent. The Intent is your event that is passed along with data from the first user interface to another.

Intents can be used between user interfaces and background services too. Also an Intent is passed when you want to broadcast data to all activities and background services.

Intent lives as an object, activity lives with a face and interactions. Hope it has been helpful.


Existing answers are fine but here is a really basic definition of the two with some links.

Activity

An application component for displaying a user interface. The activity class is where all user interactions are handled (button presses, list selections). An activity specifies a layout to represent it on screen.

Intent

An intent is a system message. It can be broadcast around the system to notify other applications (or your own!) of an event, or it can be used to request that the system display a new activity.


If all you know about Intents, is when you use them to start a new activity, then I can understand your confusion.

In the simplest case, you start a new activity like this:

Intent intent = new Intent(this, SomeOtherActivity.class);
startActivity(intent);

It sure looks like you are starting an activity, and the activity that you are starting is "intent". But what you are really doing is calling the method startActivity() and you are passing it a container called intent. That container tells startActivity() what to do.

You can see it more clearly when you are passing data to a new activity

Intent intent = new Intent(this, SomeOtherActivity.class);
startActivity(intent);
intent.putExtra("ANIMAL_TYPE", "unicorn");
intent.putExtra("ANIMAL_COLOR", "ruby");
startActivity(intent);

Now when you call startActivity(), it looks at intent and knows that it needs start the SomeOtherActivity class. Also, in the SomeOtherActivity class, you can access those passed key/value pairs from the intent like this:

Bundle extras = getIntent().getExtras(); 
if(extras !=null) {
    String animal = extras.getString("ANIMAL_TYPE");
    String animalColor = extras.getString("ANIMAL_COLOR");
}