Here are Android Interview Questions for the Experienced Android developer, these questions could make confuse you during an interview in top companies. As we all knew daily android app development growing in the market, so it’s important you have to always update own android skills. Here we are sharing some common and most asking question. Which could help you crack android interviews.
Let’s see Android Interview Questions Part #1
1. When onUpgrade() method is called in SQLite- Android database?
Answers: The onUpgrade() method is called when the database needs to be upgraded in the Android application. For an implementation should use this method to drop tables, add tables, or do anything else it needs to upgrade to the new schema version.
The SQLite ALTER TABLE documentation you can find here. If you add new columns you can use ALTER TABLE to insert them into a live table. If you rename or remove columns you can use ALTER TABLE to rename the old table, then create the new table and then populate the new table with the contents of the old table.
Bonus: know more about ” SQLite database in Android kotlin example “
2. What is the difference between commit() and apply() method in SharedPreferences() ?
Answers: commit() does this synchronously ie it blocks the thread and returns true if saved successfully or returns false if fails.
apply() writes data asynchronously and it doesn’t return any boolean values to notify the user about is success or failure.
if another editor on this sharedpreference does a regular commit() while a apply() is still outstanding, the commit() will block until all async commits are completed as well as the commit itself.
apply() was added in 2.3, it commits without returning a boolean indicating success or failure.
commit() returns true if the save works, false otherwise.
apply() was added as the Android dev team noticed that almost no one took notice of the return value, so apply is faster as it is asynchronous.
Check in reference
3. What will happen in the xhdpi device if image if 10×10 pixels image only in a drawable-hdpi directory, and ImageView’s width/height both are set to wrap_content ?
Answers: Image will scale up and the image will not look good.
4. What is Size of notification payload in GCM/FCM?
Answers: Notification messages contain a predefined set of user-visible keys. Data messages, by contrast, contain only your user-defined custom key-value pairs. Notification messages can contain an optional data payload. Maximum payload for both message types is 4KB, except when sending messages from the Firebase console, which enforces a 1024 character limit.
5. What will be minSdkVersion for the app, If an app uses both v4 and v7 support library,
Answers: There are many changes done into support library since this question has answered. Good thing is, it is very well documented also. So you should read Support Library Packages for more details and more available support library.
Bouns: “More Android Interview Questions”
- Here are Top 3 Android Developer Interview Questions Part #2
- Here Top 7 Android Developer Interview Questions Part #3
This is 5 most frequently or common Android interview questions asked in an interview with the Android developer. Maybe you feel these questions are little tough.