Top 7 Android Interview Questions #3 (Android Developer)

Android Interview questions list will never end. Android is changing most frequently and updating new components in android app development. Here we are sharing top android interview questions for android developers.

Android Interview questions part 3 android developer

Here are top Android Interview Questions

1. What is Android Activity Lifecycle?

Answers: Activity Lifecycle is a favorite question all the time. Its important for Beginner and experienced Android developer to know about full Lifecycle of activity.

Activity lifecycle has seven methods, which help in maintaining your application. These call methods are very helpful as a developer perspective.

  • onCreate()
  • onStart()
  • onResume()
  • onPause()
  • onStop()
  • onRestart()
  • onDestroy()

This answer will go long so go to this link Android Activity Lifecycle with an example, you will complete example and details.

2. What is the difference between contentProvider and contentResolver in android?

Answers : Content Resolver resolves a URI to a specific Content providers.

Content Provider provides an interface to query content to other apps or own app can interact.

The way to query a content provider is contentResolverInstance.query(URI,.....)

3. Difference between Parcelable and Serializable?

Answers: Serializable is a standard Java interface. It is not a part of the Android SDK.  Just by implementing this interface your POJO will be ready to jump from one Activity to another.

Parcelable is another interface, it’s a part of the Android SDK. Now, Parcelable was specifically designed in such a way that there is no reflection when using it. That is because we are being really explicit for the serialization process.

Its Seems tough ? But in Kotlin Parcelize is more advance not need that much code.

That it ! no so much code and hard implementation process in kotlin. You must read Parcelable Android Kotlin (Parcelize).

Conclusion.

  1. Parcelable is faster than Serializable interface
  2. Serializable interface is easy to implementation, where the Parcelable interface takes more time for implementation.
  3. Parcelable array can be pass via Intent in android
  4. Serializable interface create a lot of temporary objects and cause quite a bit of garbage collection

4. How to Set the entire Android Application in Portrait mode?

Answers : We can set enter android app in portrait mode in by Create MyApplication class and extend Application class.

Here is complete example : Android Application in Portrait mode.

5. How to Communication between two fragments?

Answers : Communication between two fragments can done with Activity. Two Fragments can send directly messages to each other. Here is 2 ways to achieve it.

First using interface, create an interface in Sender, and pass the data to the Main Activity. Then From the main activity to pass a data fragment Receiver. Read complete tutorial Communication between two fragments.

Second is using ViewModel , create an ViewModel class and implements methods in Sender pass the data to Receiver. Read complete tutorial Share data between fragments used ViewModel.

6. Differences between ConstraintLayout and RelativeLayout

Answers : In the list of 2018 interview questions , this is the top ranking android interview question.

ConstraintLayout has flat view hierarchy unlike other layouts, so it does a better performance than relative layout. This is the biggest advantage of Constraint Layout. Drag and drop GUI builder feature is second.

Here is a complete tutorial on Differences between ConstraintLayout and RelativeLayout.

7. Deference between Handler vs AsyncTask vs Thread in Android

Answers : Personally I don’t like this question, it seems like a hurdle question.

AsyncTask and Handler are written in Java (internally they use a Thread), so everything you can do with Handler or AsyncTask, you can achieve using a Thread too.

Its very long to give in details so here is the separate answer for it Handler vs AsyncTask vs Thread.


There is no option to escape with this top 7 questions, its a most common and important android interview questions for android developer.

Bouns: “More Android Interview Questions”


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.