Android Interview Questions 2017

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:

  • onCreate(Bundle): It is a method where your initialization is done. Under this, you will callsetContentView(int) with a layout resource which defines your UI. Also, you can retrieve the widgets in that UI by using findViewById(Int). These are required to interact programmatically.
  • onPause(): It is a method which deals with the user whenever it leaves the activity. So any changes made by the user should be commited which is done by the ContentProvider that holds the data.
  • 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:

  • Open-source
  • Customizable operating System
  • Variety of apps can be developed.
  • Reduces overall complexity
  • Supports messaging services, web browser, storage(SQLite), connectivity,media and many more.
  • 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

  • Forms a recommended way for app architecture through its components
  • Eliminate boilerplate code
  • Simplify complex task
  • Provide backward compatibility as libraries like support are unbundled from Android API and are re-packaged to androidx.* package
  • Inbuilt productivity feature of the Kotlin Integration
  • 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:

  • Shared Preferences – Store private primitive data in key-value pairs
  • Internal Storage – Store private data on the device memory
  • External Storage – Store public data on the shared external storage
  • SQLite Databases – Store structured data in a private database
  • 17 ANDROID INTERVIEW Questions And Answers For Experienced & Beginner Candidates | Android Interview

    Related Posts

    Leave a Reply

    Your email address will not be published. Required fields are marked *