Important Interview Questions for Android 


Q 6: What are containers?

Ans: Containers are equipped with objects and widgets, which require certain components and precise arrangements. Containers can have labels, buttons, fields, or containers for children, etc. If you want a form with fields on the left and marks on the right, you will require a container, for example. You will need to add a container if you want the OK and Cancel buttons underneath each other and flush to the right of the screen. It would help if you had a container with a root element to set the widgets within when you have many widgets.

Android has a set of view classes, which act as viewing containers. These types of containers are layouts set as XML files that our code cannot modify when executing. LinearLayout, RelativeLayout, FrameLayout, AbsoluteLayout, GridLayout, and TableLayout are the layout managers provided by Android SDK.

Q 7: What are the troubleshooting techniques you can follow if an application is frequently crashing?

Ans: If an Android application is frequently crashing, you can follow the below-given techniques:

Compatibility Check:

An application for all types of devices and operating systems cannot be tested. An application might very well be unable to be compatible with your OS.

Memory Management:

Some apps work on a mobile device flawlessly, but might crash on others. This is where power, memory management, and CPU performance are taken into account. There is limited memory space on mobile devices, and you can free up a memory space to work correctly.

You can erase the application data, clear their cache memory, provide some free space on your smartphone, and enhance app performance if an application crashes regularly.

Q 8: What is AIDL? What AIDL supports data types?

Ans:  AIDL or Android Definition Interface Language manages the necessity for a customer-service interface in order for both to communicate through interprocess communication or IPC on the same level. In this procedure, things are broken down into primitive elements that Android understands. This component is necessary simply because a process cannot access the other process' memory.

AIDL has support for the following data types:

  • string
  • charSequence
  • List
  • Map
  • all native Java data types like int, long, char, and Boolean

Q 9: What is ANR, and why does it happen? What are the initiatives you can take to avoid ANR?

Ans:

 'ANR' stands for 'Application Not Responding' in Android.It implies that the onResume() function displays "application not responding" when the user interacts with the activity. It occurs because we start a long, intensive operation such as downloading data in the main UI thread. The solution to the problem is to start your heavy tasks in the background using Async Task class.

ANR can be avoided by appropriate implementation of precautions: Lengthy database or networking processes in different threads should be carried out in an application to prevent ANR.

You may decrease strain from the UI thread using the IntentService for background task-intensive apps

Q 10: What is DDMS? Describe some of its capabilities.

Ans:  DDMS stands for the Dalvik Debug Monitor Server that ships with Android. It consists of a wide range of debugging features such as:

  • port-forwarding services
  • screen capture
  • thread and heap information
  • network traffic tracking
  • incoming call and SMS spoofing
  • simulating network state, speed, and latency
  • location data spoofing