---
title: "Describe android Activities in brief."  
description: "Describe android Activities in brief."  
author: "Anonymous User"  
published: 2015-05-28  
updated: 2020-09-22  
canonical: https://www.mindstick.com/interview/2589/describe-android-activities-in-brief  
category: "android"  
tags: ["android", "android activity"]  
reading_time: 2 minutes  

---

# Describe android Activities in brief.

Activity provides the user interface. When you create an android application in eclipse through the wizard it asks you the name of the activity. Default name is MainActivity. You can provide any name according to the need. Basically it is a class (MainActivity) that is inherited automatically from Activity class. Mostly, applications have one or more activities; and the main purpose of an activity is to interact with the user. Activity goes through a number of stages, known as an activity’s life cycle.

**Example:**

```
package com.example.careerride; //Application name careerrideimport android.os.Bundle; // Default packagesimport android.app.Activity; // Default packagesimport android.view.Menu;public class MainActivity extends Activity {@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);}@OverridepublicbooleanonCreateOptionsMenu(Menu menu) {// Inflate the menu; this adds items to the action bar if it is present.getMenuInflater().inflate(R.menu.main, menu);return true;} }
```

When you run the application onCreate method is called automatically.

## Answers

### Answer by Anonymous User

Activity provides the user interface. When you create an android application in eclipse through the wizard it asks you the name of the activity. Default name is MainActivity. You can provide any name according to the need. Basically it is a class (MainActivity) that is inherited automatically from Activity class. Mostly, applications have one or more activities; and the main purpose of an activity is to interact with the user. Activity goes through a number of stages, known as an activity’s life cycle.

**Example:**

```
package com.example.careerride; //Application name careerrideimport android.os.Bundle; // Default packagesimport android.app.Activity; // Default packagesimport android.view.Menu;public class MainActivity extends Activity {@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);}@OverridepublicbooleanonCreateOptionsMenu(Menu menu) {// Inflate the menu; this adds items to the action bar if it is present.getMenuInflater().inflate(R.menu.main, menu);return true;} }
```

When you run the application onCreate method is called automatically.


---

Original Source: https://www.mindstick.com/interview/2589/describe-android-activities-in-brief

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
