• +91 9723535972
  • info@interviewmaterial.com

Android Interview Questions and Answers

Android Interview Questions and Answers

Question - 61 : - What is use of onTrimMemory() method?

Answer - 61 : -

The onTrimMemory(int level) is used when the operating system has determined that a process to trim unneeded memory from its subprocess.

Question - 62 : - What are Handlers in Android?

Answer - 62 : -

A Handler is used to send and process Message and Runnable objects associated with a thread's MessageQueue. When a Handler created default bound with a Looper class. It will deliver messages and runnable to that Looper's message queue and execute them on Looper's thread.

Handlers are mainly used to Update the User Interface from a background thread, Enqueue a task for a different thread and Schedule a task for a specified time.

Question - 63 : - What is IntentService?

Answer - 63 : -

IntentService is a direct subclass for Services that handle asynchronous requests on demand. Clients send requests through Context. It is born to make things easier. It is also used to perform a certain task in the background. The instance of IntentService terminates itself automatically when needed.

Question - 64 : - Explian the use of AsyncTasks?

Answer - 64 : -

Android AsyncTask going to do background operation on the background thread and update on the main thread. In android, We can't directly touch the background thread to the main thread in android development. asyncTask helps us to make communication between the background thread to the main thread.

Question - 65 : - What is service in Android? List its types?

Answer - 65 : -

Services in Android are a component that acts as an application to run in the background in order to perform long-running operation tasks.

The types of Services are listed below:

  • Background Services
  • Foreground Services
  • Bound Services

Question - 66 : - What is use of FLAG_ACTIVITY_CLEAR_TASK?

Answer - 66 : -

In Android, FLAG_ACTIVITY_CLEAR_TASK is used to end any previously existing task that helps to start new Activity in conjunction with FLAG_ACTIVITY_NEW_TASK.

Question - 67 : - What's the difference between onCreate() and onStart()?

Answer - 67 : -

The major difference between onCreate() and onStart() is as follows.

onCreate() is called when the Activity is created; that is, it is launched or started. (Additionally, this triggers when the orientation is changed.) It is called again when the process is killed, then returned to.

while onStart() called following onCreate() at startup. Additionally, it is also called when the app is navigated back to after onStop() (and following onRestart()), which occurs after the Activity is no longer visible (which is during the time that "the user can see the activity on-screen, though it may not be in the foreground and interacting with the user").

Question - 68 : - Please explain the lifecycle of an Activity?

Answer - 68 : -

Android is an open-source operating system that can be useful for many tasks. An android application will undergo various states that are associatively called as Android Activity Life Cycle.

The lifecycle of activity consists of 7 methods:-

  1. onCreate() - The function onCreate() is called When a user first opens an activity that acts the same as a constructor of a class. 
  2. onStart() - The function onStart() is called when an activity becomes visible to the user and is called after onCreate.
  3. onResume() - The function onResume() is called just before the user starts interacting with the application.
  4. onPause() - The function onPause() is called when the app is partially visible to the user on the mobile screen.
  5. onStop() - The function onStop() is called when the activity is no longer on the activity stack and not visible to the user.
  6. onRestart() - The function onRestart() is called when the activity in the stopped state is about to start again.
  7. onDestroy() - The function onDestroy() is  called when the activity is cleared from the application stack.

Question - 69 : - What is an "Emulator" in Android?

Answer - 69 : -

The Android Emulator imitates Android devices on your system. Therefore, users will be able to check your application on a spread of devices and Android API levels without having to possess every physical device. The emulator provides the majority of the capabilities of a real Android device

Question - 70 : - What is NDK?

Answer - 70 : -

NDK stands for The Native Development Kit which is a set of tools. It allows you to use C and C++ code with Android. It also provides platform libraries that you can use to manage native activities and access physical device components, such as sensors and touch input.


NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners