Android Interview Questions and Answers: In the ever-growing field of mobile app development, Android is one of the most popular and widely used platforms. As a result, there is a constant demand for skilled Android developers in the job market. To help aspiring candidates prepare for their Android technical interview, we have compiled a comprehensive list of the Top 100 Android Interview Questions and Answers. Our curated list includes the latest Android Interview Questions that cover a wide range of topics and concepts.
★★ Latest Technical Interview Questions ★★
Android Technical Interview Questions
Whether you are a fresher or an experienced professional, our Android Interview Questions and Answers will help you ace your interview and land your dream job. So, let’s dive into the world of Android Interview Questions for Freshers!
Top 100 Android Interview Questions and Answers 2023
1. What is Android?
Ans: Android is an open-source mobile operating system based on the Linux kernel. It is used in a variety of mobile devices, including smartphones, tablets, and smartwatches.
2. What are the key components of Android architecture?
Ans: The key components of Android architecture are:
- Linux kernel
- Hardware Abstraction Layer (HAL)
- Native Libraries
- Android Runtime (ART)
- Framework
- Applications
3. What is an Activity in Android?
Ans: An Activity is a single screen that the user can interact with. It is one of the core components of an Android application and manages the user interface and lifecycle of an application.
4. What are the features of Android architecture?
Ans: The Android architecture is comprised of distinct layers within the Android stack, including the operating system, middleware, and applications, each of which provides unique services to the layer immediately above it.
There are five layers that compose the Android stack.
- Linux Kernel: This layer is responsible for managing device drivers, memory, power, resources, and device management.
- Libraries: A set of libraries is available, including open-source WebKit for browsing, well-known labs, libraries for playing and recording audio and video, SQLite database for application data sharing and storage, and SSL libraries for internet security.
- Android Runtime: The core libraries and DVM (Dalvik Virtual Machine) or ART (Android RunTime) as runtime are included to run Android applications. DVM is optimized for mobile devices, providing fast performance and consuming less memory. ART virtual machine was introduced to execute Android apps from Android Lollipop 5.0 version (API level 21), replacing DVM.
- Android Framework: This layer provides Android APIs like UI (User Interface), content providers (data), resources, locations, telephony, and package managers. It offers interfaces and classes for the development of Android applications.
- Android Applications: A variety of applications are available, such as home, games, contacts, settings, browsers, etc. These apps utilize the Android framework and Android runtime and libraries.
5. What is the syntax for registering a BroadcastReceiver in Android?
Ans: To register a BroadcastReceiver in Android, you need to create a Java class that extends the BroadcastReceiver class and add it to the AndroidManifest.xml file. The syntax for registering a BroadcastReceiver is as follows:
<receiver android:name=”.MyReceiver”> <intent-filter> <action android:name=”android.intent.action.BOOT_COMPLETED” /> </intent-filter> </receiver> |
6. What is a ContentProvider in Android?
Ans: A ContentProvider is a component of an Android application that manages access to a structured set of data. It provides a standard interface for sharing data between applications.
7. What is the life cycle of Android activity?
Ans: Here are the lifecycle methods of an Android activity, each with a brief explanation:
- onCreate(): Called when the activity is created. This is where views are created and data is collected from bundles.
- onStart(): Called when the activity is becoming visible to the user. It may be followed by
- onResume() if the activity comes to the foreground, or onStop() if it becomes hidden.
- onResume(): Called when the activity will start an interaction with the user.
- onPause(): Called when the activity is moving to the background but hasn’t been killed yet.
- onStop(): Called when the activity is no longer visible to the user.
- onDestroy(): Called when the activity is finished or destroyed.
- onRestart(): Called after the activity has been stopped, prior to it being started again.
8. What is the difference between an implicit and explicit intent in Android?
Ans:
- An explicit intent is used to start a specific component within the same app, such as starting a new activity.
- An implicit intent is used to request an action from any component that can handle the specified action, such as sending an email or opening a website.
9. What is a Fragment in Android?
Ans: A Fragment is a reusable portion of a user interface in an Android application. It can be combined with other fragments to create a flexible and modular user interface.
10. What is an Adapter in Android?
Ans: An Adapter is a bridge between a user interface component and the underlying data for that component. It is used to provide data to a ListView or RecyclerView.
11. What is a RecyclerView in Android?
Ans: A RecyclerView is a more flexible and advanced version of ListView. It is used to display large sets of data in a scrolling view.
12. What is the syntax for creating a new RecyclerView in Android?
Ans: To create a new RecyclerView in Android, you need to add the RecyclerView widget to your layout file and create a new adapter class that extends the RecyclerView.Adapter class. The syntax for creating a new RecyclerView is as follows:
<androidx.recyclerview.widget.RecyclerView android:id=”@+id/recycler_view” android:layout_width=”match_parent” android:layout_height=”match_parent” /> |
13. What is the syntax for removing an item from a RecyclerView in Android?
Ans: To remove an item from a RecyclerView in Android, you need to remove the item from your data source and call the notifyItemRemoved() method on your adapter. The syntax for removing an item from a RecyclerView is as follows:
list.remove(position); adapter.notifyItemRemoved(position); |
14. What is a ContentResolver in Android?
Ans: A ContentResolver is a class that provides methods for accessing data from a ContentProvider. It is used to retrieve and modify data stored in a ContentProvider.
15. List the languages used to build Android.
Ans: Here are the most popular programming languages used for developing Android applications:
- Java: Java has always been the preferred language for Android development and is used by most developers. IDEs such as Eclipse, NetBeans, and IntelliJ are commonly used for Java-based Android development.
- Kotlin: Kotlin is a modern, safe, and object-oriented cross-platform programming language that is gaining popularity among Android developers. IDEs such as Android Studio and Eclipse are commonly used for Kotlin-based Android development.
- C#: Using the C# language, developers can create native iOS and Android mobile applications. Visual Studio is the most popular tool for developing an Android application using C#.
- Python: Python is a dynamic and object-oriented programming language popular for machine learning. Pydroid 3, Dcoder, and spck code editor are some of the code editors used for Python-based Android development.
- Other languages: Other languages such as C++ and HTML 5 can also be used for Android development. IDEs such as C4droid, CppDroid, and AIDE are used for C++ development, while Acode and spck code editor are examples of IDEs used with HTML.
16. What is the difference between startService() and bindService() in Android?
Ans:
- startService() is used to start a service in the background, while bindService() is used to establish a connection to a service that is already running.
- startService() does not return a result, while bindService() can return a result through a callback method.
17. What is a BroadcastReceiver in Android?
Ans:
- A BroadcastReceiver is a component that responds to system-wide events, such as a low battery warning or a network connection change.
- It can be used to perform actions such as sending a notification or starting a service.
18. What is a Thread in Android?
Ans: A Thread is a unit of execution that is used to perform background operations in an Android application. It is used to execute long-running operations without blocking the main thread.
19. What is the difference between Serializable and Parcelable in Android?
Ans: Serializable and Parcelable are both interfaces used for passing data between components in an Android application. However, Parcelable is faster and more efficient than Serializable because it requires less memory and avoids the overhead of reflection.
20. What is the difference between onCreate() and onStart() in Android?
Ans: onCreate() is called when an Activity is first created, while onStart() is called when the Activity is about to become visible. onStart() is called after onCreate() and before onResume().
21. What is the difference between onResume() and onPause() in Android?
Ans: onResume() is called when an Activity is about to become visible, while onPause() is called when an Activity is about to be hidden. onPause() is called before onStop().
22. What is the difference between onStop() and onDestroy() in Android?
Ans: onStop() is called when an Activity is no longer visible, while onDestroy() is called when an Activity is about to be destroyed. onStop() is called before onDestroy().
23. What is the difference between startActivity() and startActivityForResult() in Android?
Ans: startActivity() is used to start a new Activity in an Android application, while startActivityForResult() is used to start a new Activity and expect a result back from that Activity.
24. What is the difference between View.GONE and View.INVISIBLE in Android?
Ans: View.GONE and View.INVISIBLE are used to make a View invisible, but View.GONE removes the View from the layout completely, while View.INVISIBLE keeps the View in the layout but makes it invisible.
25. What is the difference between match_parent and wrap_content in Android?
Ans: match_parent is used to make a View fill the available space in a layout, while wrap_content is used to make a View only as big as necessary to fit its content.
26. What is the difference between ListView and RecyclerView in Android?
Ans: RecyclerView is a more advanced and flexible version of ListView. It is used to display large sets of data in a scrolling view, and it provides better performance and more flexibility than ListView.
27. What is the difference between a FragmentTransaction and a BackStack Transaction in Android?
Ans: A FragmentTransaction is used to add, remove, or replace Fragments in an Android application, while a BackStackTransaction is used to manage the back stack of Fragments. A BackStackTransaction is used to allow the user to navigate back through the history of Fragments.
28. What is the difference between a Toast and a Snackbar in Android?
Ans: A Toast is a simple message that appears briefly at the bottom of the screen, while a Snackbar is a message that appears at the bottom of the screen and can be dismissed by the user. Snackbar provides more functionality than Toast.
29. What is the difference between a Service and an IntentService in Android?
Ans: A Service is a component of an Android application that runs in the background, while an IntentService is a subclass of Service that performs a single operation on a separate thread. IntentService is used for long-running operations that do not require user interaction.
30. What is the difference between a BroadcastReceiver and a ContentObserver in Android?
Ans: A BroadcastReceiver is a component of an Android application that listens for system or application-wide events and reacts to them, while a ContentObserver is a class that listens for changes to a ContentProvider and reacts to them.
31. What is the difference between a GridView and a GridLayout in Android?
Ans: GridView is a ViewGroup that displays items in a two-dimensional grid, while GridLayout is a View that arranges child Views in a rectangular grid. GridLayout is more flexible than GridView because it can be used to create more complex layouts.
32. What is the difference between a WebView and a Browser in Android?
Ans: A WebView is a View that displays web pages inside an Android application, while a Browser is a separate application that is used to browse the web.
33. What is the difference between an Activity and a Fragment in Android?
Ans: An Activity is a single screen in an Android application, while a Fragment is a portion of an Activity that can be added, removed, or replaced without affecting the rest of the Activity.
34. What is the difference between a Theme and a Style in Android?
Ans: A Theme is a collection of resources, such as colors, styles, and layout files, that define the look and feel of an Android application. A Style is a set of attributes that can be applied to a View or a ViewGroup to change its appearance.
35. What is the difference between a Drawable and a Bitmap in Android?
Ans: A Drawable is a general term for a graphic that can be drawn to the screen, while a Bitmap is a specific type of graphic that is made up of pixels.
36. What is the difference between a Notification and a NotificationCompat in Android?
Ans: A Notification is a message that appears in the status bar of an Android device to alert the user of an event, while NotificationCompat is a support library that provides backward compatibility for newer Notification features on older devices.
37. What is the syntax for starting a new Activity in Android?
Ans: To start a new Activity in Android, you need to create a new Intent and call the startActivity() method. The syntax for starting a new Activity is as follows:
Intent intent = new Intent(this, MyActivity.class); startActivity(intent); |
38. What is the difference between a Cursor and a ContentProvider in Android?
Ans: A Cursor is a data structure that allows random access to the results of a database query, while a ContentProvider is a class that provides a standard interface for accessing data in an Android application.
39. What is the difference between a Thread and an AsyncTask in Android?
Ans: A Thread is a unit of execution in an Android application that runs in the background, while an AsyncTask is a subclass of Thread that is designed to perform short-term background operations and then return results to the main thread.
40. What is the syntax for updating an item in a RecyclerView in Android?
Ans: To update an item in a RecyclerView in Android, you need to update the item in your data source and call the notifyItemChanged() method on your adapter. The syntax for updating an item in a RecyclerView is as follows:
list.set(position, item); adapter.notifyItemChanged(position); |
41. What is the difference between a FragmentPagerAdapter and a FragmentStatePagerAdapter in Android?
Ans: A FragmentPagerAdapter is a PagerAdapter that displays Fragments in memory, while a FragmentStatePagerAdapter is a PagerAdapter that displays Fragments on demand and saves them to disk when they are not in use.
42. What is the difference between a ProgressDialog and a ProgressBar in Android?
Ans: A ProgressDialog is a dialog that displays a message and a spinning wheel to indicate that a task is in progress, while a ProgressBar is a View that displays a progress bar to indicate the progress of a task.
43. What is the difference between a Bundle and a Bundle savedInstanceState in Android?
Ans: A Bundle is a data structure that is used to pass data between components in an Android application, while a Bundle savedInstanceState is a Bundle that is passed to an Activity or Fragment when it is recreated after being destroyed.
44. What is the difference between a Handler and a Runnable in Android?
Ans: A Handler is a class that is used to send messages between threads in an Android application, while a Runnable is an interface that is used to define a unit of work that can be executed on a separate thread.
45. What is the difference between a Menu and a ContextMenu in Android?
Ans: A Menu is a collection of options that appears in the ActionBar or Toolbar of an Android application, while a ContextMenu is a menu that appears when the user performs a long press on a View.
46. What is the difference between a ListView and a GridView in Android?
Ans: A ListView is a View that displays a list of items in a scrolling view, while a GridView is a ViewGroup that displays items in a two-dimensional grid.
47. What is the difference between an AlertDialog and a DialogFragment in Android?
Ans: An AlertDialog is a dialog that appears on top of an Activity or Fragment to display a message or ask the user for input, while a DialogFragment is a Fragment that can be used to display a dialogue.
48. What is the difference between onCreate() and onStart() in Android?
Ans: onCreate() is a lifecycle method that is called when an Activity or Fragment is first created, while onStart() is a lifecycle method that is called when an Activity or Fragment is visible to the user.
49. What is the syntax for defining an Android Activity?
Ans: To define an Android Activity, you need to create a Java class that extends the Activity class. The syntax for defining an Activity is as follows:
public class MyActivity extends Activity { // Activity code here } |
50. What is the difference between onResume() and onPause() in Android?
Ans: onResume() is a lifecycle method that is called when an Activity or Fragment is about to become active and visible to the user, while onPause() is a lifecycle method that is called when an Activity or Fragment is about to become inactive and partially visible to the user.
51. What is a service in Android?
Ans:
- A service is a component that runs in the background and performs long-running operations, such as playing music or downloading files.
- It runs independently of the UI, and can communicate with other components through messages or intents.
52. What is the purpose of the onCreateOptionsMenu() method in Android?
Ans:
- The onCreateOptionsMenu() method is used to create the options menu for an activity or fragment.
- It is called once when the activity is created, and is used to inflate the menu layout and add items to the menu.
53. What is the difference between onStop() and onDestroy() in Android?
Ans: onStop() is a lifecycle method that is called when an Activity or Fragment is no longer visible to the user, while onDestroy() is a lifecycle method that is called when an Activity or Fragment is about to be destroyed and removed from memory.
54. What is the difference between onSaveInstanceState() and onRestoreInstanceState() in Android?
Ans: onSaveInstanceState() is a lifecycle method that is called when an Activity or Fragment is about to be destroyed to save its state, while onRestoreInstanceState() is a lifecycle method that is called when an Activity or Fragment is recreated after being destroyed to restore its state.
55. What is the difference between a Service and a BroadcastReceiver in Android?
Ans: A Service is a component that runs in the background to perform long-running tasks, while a BroadcastReceiver is a component that receives and handles system-wide broadcast messages.
56. What is the difference between an Intent and an IntentFilter in Android?
Ans: An Intent is a message that is used to communicate between components in an Android application, while an IntentFilter is used to specify the types of Intents that a component can receive.
57. What is the difference between a ViewModel and a LiveData in Android?
Ans: A ViewModel is a class that is designed to store and manage data for an Activity or Fragment, while a LiveData is a class that is used to observe changes in data and notify observers when the data changes.
58. What is the difference between a View and a ViewGroup in Android?
Ans: A View is a basic building block of an Android user interface, while a ViewGroup is a container for Views that can be used to arrange them in a specific layout.
59. What is the difference between a ConstraintLayout and a LinearLayout in Android?
Ans: A ConstraintLayout is a ViewGroup that is designed to create complex layouts with constraints between views, while a LinearLayout is a ViewGroup that is designed to create simple linear layouts where views are arranged either horizontally or vertically.
60. What is the syntax for defining an Android Fragment?
Ans: To define an Android Fragment, you need to create a Java class that extends the Fragment class. The syntax for defining a Fragment is as follows:
public class MyFragment extends Fragment { // Fragment code here } |
61. What is the difference between Serializable and Parcelable in Android?
Ans:
- Serializable is a standard Java interface for serializing objects, while Parcelable is an Android-specific interface.
- Parcelable is generally faster and more efficient than Serializable, but it requires more code to implement.
62. What is an AsyncTask in Android?
Ans:
- An AsyncTask is a helper class that allows you to perform background operations on a separate thread from the main UI thread.
- It is used to perform operations that may take a long time, such as downloading a large file, without blocking the UI.
63. What is a service in Android?
Ans:
- A service is a component that runs in the background and performs long-running tasks, such as downloading a file or playing music.
- It does not have a user interface, and can be started or stopped by other components, such as an activity or broadcast receiver.
64. What is a notification in Android?
Ans:
- A notification is a message that appears outside of the app UI to alert the user to an event, such as a new message or a reminder.
- It can include an icon, title, message, and action buttons.
65. What is an Android Fragment?
Ans:
- A Fragment is a modular section of an activity that can be used to build more flexible user interfaces.
- It has its own lifecycle, and can be added, removed, or replaced dynamically.
66. What is a layout in Android?
Ans:
- A layout is a XML file that defines the user interface for an activity or fragment.
- It includes elements such as views, text, images, and buttons.
67. What is the difference between match_parent and wrap_content in Android?
Ans:
- match_parent tells the view to match the parent container in width or height, while wrap_content tells the view to adjust its size to fit its contents.
- match_parent can be used to fill the entire screen, while wrap_content can be used to prevent the view from taking up too much space.
68. What is the Android Manifest file?
Ans:
- The Android Manifest file is an XML file that contains essential information about the app, such as its package name, version, permissions, and activities.
- It is required for all Android apps, and must be included in the root directory of the app.
69. What is a resource in Android?
Ans:
- A resource is a file or data that is included with the app and can be accessed at runtime.
- It can include things like images, strings, layouts, and animations.
70. What is the purpose of the findViewById() method in Android?
Ans:
- The findViewById() method is used to retrieve a view object that is defined in the layout XML file.
- It is used to manipulate the properties and behavior of the view at runtime.
71. What is an Adapter in Android?
Ans:
- An Adapter is a class that is used to provide data to a UI element, such as a ListView or RecyclerView.
- It converts data from a source, such as a database or an array, into a format that can be displayed by the UI element.
72. What is a RecyclerView in Android?
Ans:
- A RecyclerView is a UI component that is used to display a list of items, such as contacts or messages.
- It is more flexible and efficient than a ListView, and allows for custom layouts and animations.
73. What is the purpose of the setOnClickListener() method in Android?
Ans:
- The setOnClickListener() method is used to assign a listener to a view object, such as a button or an image.
- It is used to handle user interactions with the view, such as clicking or tapping.
74. What is the difference between a thread and a process in Android?
Ans:
- A process is a container for a set of resources, including memory and system files, while a thread is a sequence of instructions that can be executed within a process.
- A process can contain multiple threads, but each thread can only belong to one process.
75. What is the purpose of the runOnUiThread() method in Android?
Ans:
- The runOnUiThread() method is used to update the UI from a background thread.
- It allows you to modify UI elements such as text, images, and buttons, without causing an error.
76. What is the syntax for creating a new adapter for a RecyclerView in Android?
Ans: To create a new adapter for a RecyclerView in Android, you need to create a Java class that extends the RecyclerView.Adapter class and override the necessary methods. The syntax for creating a new adapter for a RecyclerView is as follows:
public class MyAdapter extends RecyclerView.Adapter<MyViewHolder> { @Override public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { // Adapter code here return null; } @Override public void onBindViewHolder(MyViewHolder holder, int position) { // Adapter code here } @Override public int getItemCount() { // Adapter code here return 0; } } |
77. What is an Intent in Android?
Ans: An Intent is a messaging object that is used to request an action from another component of an Android application. It is used to communicate between different components of an application or between different applications.
78. What is the syntax for creating a new Service in Android?
Ans: To create a new Service in Android, you need to create a Java class that extends the Service class. The syntax for creating a new Service is as follows:
public class MyService extends Service { // Service code here } |
79. What is the syntax for passing data between Activities in Android?
Ans: To pass data between Activities in Android, you need to add extra data to the Intent. The syntax for passing data between Activities is as follows:
Intent intent = new Intent(this, MyActivity.class); intent.putExtra(“key”, value); startActivity(intent); |
80. What is the purpose of the SharedPreferences class in Android?
Ans:
- The SharedPreferences class is used to store key-value pairs in persistent storage.
- It can be used to store user preferences, settings, and other data that needs to be accessed across multiple app sessions.
81. What is the purpose of the onSaveInstanceState() method in Android?
Ans:
- The onSaveInstanceState() method is used to save the state of an activity or fragment when it is destroyed due to a configuration change, such as a screen rotation.
- It is used to restore the previous state of the activity or fragment when it is recreated.
82. What is the purpose of the setText() method in Android?
Ans:
- The setText() method is used to set the text content of a TextView or EditText view.
- It can be used to dynamically update the text content of a view at runtime.
83. What is the syntax for creating a new AsyncTask in Android?
Ans: To create a new AsyncTask in Android, you need to create a Java class that extends the AsyncTask class and override the necessary methods. The syntax for creating a new AsyncTask is as follows:
private class MyTask extends AsyncTask<Void, Void, Void> { @Override protected Void doInBackground(Void… voids) { // AsyncTask code here return null; } } |
84. What is a loader in Android?
Ans:
- A loader is a component that is used to load data from a data source, such as a database or network, into an activity or fragment.
- It runs asynchronously and provides a callback when the data is loaded, allowing the UI to remain responsive.
85. What is the purpose of the onCreate() method in Android?
Ans:
- The onCreate() method is used to initialize the activity or fragment when it is created.
- It is called only once during the lifecycle of the activity or fragment, and is used to set up the UI and any necessary data structures
86. What is a LiveData in Android?
Ans: A LiveData is an observable data holder class that is used to update the user interface automatically when the underlying data changes.
87. What is a Room in Android?
Ans: Room is a persistence library that provides an abstraction layer over SQLite. It is used to create and manage a SQLite database for an Android application.
88. What is the syntax for creating a new Intent in Android?
Ans: To create a new Intent in Android, you need to specify the action and the data to be passed. The syntax for creating a new Intent is as follows:
Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(“http://www.example.com”)); |
89. What is the difference between a ContentResolver and a CursorLoader in Android?
Ans: A ContentResolver is a class that provides a standard interface for accessing data in an Android application, while a CursorLoader is a class that loads data from a ContentProvider into a Cursor in the background.
90. What is the difference between a SharedPreferences and a SQLite database in Android?
Ans: SharedPreferences is a simple key-value storage mechanism that is used to store small amounts of data in an Android application, while a SQLite database is a more robust storage mechanism that can store larger amounts of structured data.
91. What is the difference between a Broadcast and a Message in Android?
Ans: A Broadcast is a system-wide message that can be received by any component in an Android application, while a Message is a message that is sent between threads in an Android application.
92. What is the syntax for binding to a Service in Android?
Ans: To bind to a Service in Android, you need to call the bindService() method and pass in a ServiceConnection object. The syntax for binding to a Service is as follows:
Intent intent = new Intent(this, MyService.class); bindService(intent, serviceConnection, Context.BIND_AUTO_CREATE); |
93. What is a Service in Android?
Ans: A Service is a component of an Android application that runs in the background, without any user interaction. It is used to perform long-running operations or to perform tasks that need to continue even when the application is not in the foreground.
94. What is the syntax for defining a ContentProvider in Android?
Ans: To define a ContentProvider in Android, you need to create a Java class that extends the ContentProvider class and implement the necessary methods. The syntax for defining a ContentProvider is as follows:
public class MyContentProvider extends ContentProvider { // ContentProvider code here } |
95. What is the difference between onCreate() and onStart() in an Android activity?
Ans:
- onCreate() is called when the activity is first created, while onStart() is called when the activity becomes visible.
- onCreate() is used for one-time initialization of the activity, while onStart() is used for setting up the user interface.
96. How do you handle orientation changes in an Android application?
Ans:
- By default, when the orientation of the device changes, the activity is destroyed and recreated.
- To handle orientation changes, you can override the onSaveInstanceState() and
- onRestoreInstanceState() methods to save and restore the state of the activity.
97. What is a content provider in Android?
Ans:
- A content provider is a component that manages a shared set of app data that can be accessed by other apps.
- It allows you to securely share data between different apps, and provides a consistent way to access data across different types of data sources.
98. What is an Intent in Android?
Ans:
- An Intent is a messaging object that can be used to request an action from another app component, or to start a new activity.
- It can be used to pass data between activities, services, and broadcast receivers.
99. What is the syntax for querying data from a ContentProvider in Android?
Ans: To query data from a ContentProvider in Android, you need to call the query() method on a ContentResolver object. The syntax for querying data from a ContentProvider is as follows:
ContentResolver resolver = getContentResolver(); Cursor cursor = resolver.query(uri, projection, selection, selectionArgs, sortOrder); |
100. What is an AsyncTask in Android?
Ans: An AsyncTask is a helper class that is used to perform background operations and update the user interface. It is used to perform long-running operations without blocking the main thread.
The Top 100 Android Interview Questions and Answers provide a valuable resource for candidates seeking to succeed in their Android technical interview and secure their dream job. To expand your knowledge, we invite you to follow us on freshersnow.com and stay updated with the latest information and resources.