Q What is an Activity? Which method is implemented by all subclasses of an Activity?
An Activity is the screen representation of an application in Android.
It serves as an entry point for the user’s interaction. Each activity has a layout file where you can place your UI. An application can have different activities. For example, facebook start page where you enter your email/phone and password to login acts as an activity.
Below are the two methods which almost all subclasses of Activity will implement:
An activity is implemented as a subclass of Activity class as follows:
Q3. What are the features of Android?
Google has changed the lives of everyone by launching a product that improves the mobile experience for everyone. Android helps in understanding your tastes and needs, by giving various features such as having wallpapers, themes, and launchers which completely change the look of your device’s interface.
Android has plenty of features. Some of the features are listed below:
Q2 What is the difference between a fragment and an activity?
Activity is typically a single, focused operation that a user can perform such as dial a number, take a picture, send an email, view a map etc.
Fragment is a modular section of an activity, with its own lifecycle and input events, and which can be added or removed at will. Also, a fragment’s lifecycle is directly affected by its host activity’s lifecycle i.e. when the activity is paused, so are all fragments in it, and when the activity is destroyed, so are all of its fragments.
Q3 What are the containers?
Containers, holds objects and widgets together, depending on which specific items are needed and in what particular arrangement that is wanted. Containers may hold labels, fields, buttons, or even child containers, as examples.
3 What’s the Android jetpack and its Key Benefits?
Jetpack is nothing but a set of software components, libraries, tools, and guidance to help in developing great Android apps. Google launched Android Jetpack in 2018. Key Benefits of Android Jetpack
To read more, refer to the article: Introduction to Android Jetpack
Why do we need to call setContentView() in onCreate() of Activity class?
The reason for doingso is that the activity life cycle onCreate() method is called only once. And this is the big reason we need to call the setContentView() in onCreate(). And it will be inefficient to call this function in onResume(), onStart(), and somewhere else because those methods are called more than once.
Q2 What are the different storage methods in Android?
Android offers several options to see persistent application data. They are: