What is an android Activity,AppCompatActivity and Fragment Activity. Interview Question

  • An Activity is an user accessible screen.
  • An activity class loads the all UI widget/component through XML file
  • Every activity must be declared in androidmanifest.xml file which is in your project
  • Activity is a baseline class. Its derived from "android.view.ContextThemeWrapper"
  • AppComptActivity - Its used for defined the material design widget in UI. We are using AppCompatActivity instead of the ActionBarActivity (ActionBarActivity is Deprecated). AppCompatActivity derived from "androidx.fragment.app.FragmentActivity".
  • FragmentActivity - Its used to define the Nested fragment in our activity class. Its inherit from "androidx.activity.ComponentActivity" and ComponentActivity is derived from our Baseline Activity class
  • Dependency for AppCompatActivity:
 implementation 'androidx.appcompat:appcompat:1.1.0'





Comments

Popular posts from this blog

Google Assistant Implementation in Android application with app actions