0

I have just started learning android and am not able to understand what an activity is. My question is, is creating an activity same as creating a new class? A class is just referred as an activity in android. Also can't a UI screen have multiple java classes or one UI page will have only one java class?

  • 1
    There are lots of links on stackoverflow explaining what an activity is: https://stackoverflow.com/questions/8180180/android-can-somebody-please-explain-what-is-activity-context-intent-in-android – sbso Sep 10 '18 at 22:28
  • One screen can have multiple classes attached... They're called fragments... – Kushan Sep 10 '18 at 22:43

1 Answers1

0

From https://developer.android.com/reference/android/app/Activity

An activity is a single, focused thing that the user can do. Almost all activities interact with the user, so the Activity class takes care of creating a window for you in which you can place your UI with setContentView(View)

We can say Activity is a Java class that the user can interact with.

Pang
  • 9,564
  • 146
  • 81
  • 122
M.Radwan
  • 20
  • 2