1. Do you know what is Google Android SDK? What are the tools placed in android SDK?

The Google Android SDK is a toolset that provides a developer the API libraries and tools required to build, test, and debug apps for Android in Windows, Mac or Linux. The tools placed in Android SDk are:

► Android Emulator
► DDMS – Dalvik Debug Monitoring Services
► AAPT – Android Asset Packaging tool
► ADB – Android debug bridge

2. Explain me what is the difference between File, Class, and Activity in android?

The difference between them are as follows:

► File is a block of arbitrary information or resources for storing information. It can be any file type.
► Class is a compiled from of .Java file which Android uses to produce an executable apk.
► Activity is the equivalent of a Frame/Window in GUI toolkits. It is not a file or a file type but just a class that can be extended in Android to load UI elements on view.

3. Do you know what is a Toast? Write its syntax?

Toast notification is a message that pops up on the window.
It only covers the expanse of space required for the message and the user's recent activity remains visible and interactive.
The notification automatically fades in and out and does not accept interaction events.
Syntax:

Toast.makeText(ProjectActivity.this, "Your message will come here", Toast.LENGTH_LONG).show();

4. Explain me 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:

☛ Customizable operating System
☛ Variety of apps can be developed.
☛ Reduces overall complexity
☛ Supports messaging services, web browser, storage(SQLite), connectivity, media and many more.

5. Tell us what is an ANR? What are some measures you can take to avoid ANR?

ANR stands for ‘Application Not Responding'. This dialogue is displayed if the main thread in the application has been unresponsive for a long time and in the following conditions:

☛ When there is no response to an input event after 5 seconds.
☛ When a broadcast receiver is not done executing within 10 seconds.

Following measures can be taken to avoid ANR:

► To avoid ANR, an app should perform a lengthy database or networking operations in separate threads.
► One technique is to create a child thread to prevent the Android system from concluding a code that has been unresponsive for a long period of time. Most of the actual workings of the codes can be placed within the child thread to ensure that the main thread runs with minimal unresponsive time.
► For background task-intensive apps, you can alleviate pressure from the UI thread by using the IntentService.

6. Tell me what is APK format?

The APK file or Android application package is the compressed file format that is used to distribute and install application software and middleware onto Google's Android operating system. The file has .apk extension and has all the application code, resource files, certificates, and other files, compressed in it.

7. Tell me what are broadcast receivers? How is it implemented?

► Broadcast Receiver is a mechanism using which host application can listen for System level events.
► Broadcast receiver is used by the application whenever they need to perform the execution based on system events. Like listening for Incoming call, sms etc.
► Broadcast receivers helps in responding to broadcast messages from other application or from the system.
► It is used to handle communication between Android operating system and applications.

It is implemented as a subclass of BroadcastReceiver class and each message is broadcaster as an Intent object.

public class MyReceiver extends BroadcastReceiver {
Public void onReceive(context,intent){}
}

8. Explain me what is the life cycle of android activity?

User navigates between different screen or app, it goes through different states in their lifecycle. So an activity lifecycle consists of 7 different methods of android.app.Activity class i.e :

► onCreate() : In this state, the activity is created.

► onStart(): This callback method is called when the activity becomes visible to the user.

► onResume(): The activity is in the foreground and the user can interact with it.

► onPause(): Activity is partially obscured by another activity. Other activity that's in the foreground is semi-transparent.

► onStop(): The activity is completely hidden and not visible to the user.

► onDestroy(): Activity is destroyed and removed from the memory.

9. Tell us 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 committed which is done by the ContentProvider that holds the data.

10. Explain me what is the difference between an implicit intent and explicit intent as Sr. Android Developer?

Implicit Intent is used whenever you are performing an action. For example, send email, SMS, dial number or you can use a Uri to specify the data type. For example:

☆ Intent i = new Intent(ACTION_VIEW,Uri.parse("<a href="https://www.globalguideline.com">https://www.globalguideline.com</a>"));
☆ startActivity(i);

Explicit, on the other hand, helps you to switch from one activity to another activity(often known as the target activity). It is also used to pass data using putExtra method and retrieved by other activity by getIntent().getExtras() methods.

For example:
☛ Intent i = new Intent(this, Activitytwo.class); #ActivityTwo is the target component
☛ i.putExtra("Value1","This is ActivityTwo");
☛ i.putExtra("Value2","This Value two for ActivityTwo");
☛ startactivity(i);

Download Interview PDF