Skip to content

Top 5 Android Interview Questions #1 (Android Developer)

  • by

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 your own android skills. Here we are sharing some common and most asking questions. Which could help you crack android interviews.

Top 5 Android Interview Questions 1 Android Developer

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 the 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 its 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

commit() https://developer.android.com/reference/android/content/SharedPreferences.Editor#commit()

apply() https://developer.android.com/reference/android/content/SharedPreferences.Editor#apply()

3.  What will happen in the xhdpi device if the image is 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 the size of the 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. The 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 the 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 libraries.


Bouns: “More Android Interview Questions”

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.

Leave a Reply

Discover more from Tutorial

Subscribe now to keep reading and get access to the full archive.

Continue reading