# 1K

Senior Android Software Engineer interview questions shared by candidates

## Top Interview Questions

Sort: Relevance|Popular|Date
Senior Android Developer was asked...February 1, 2017

### Remove duplicate from contact list.

We can use a HashMap for it where name will be the key and phone number will be the value. If second time any name appears then its key will be already present in the map and it will be deleted. Less

Name can be same. A contact will be duplicated only if phone number is same. Need to use number as key. Less

Instead of map you can use set

### Given a project, was required to refactor it using the MVP pattern an solving hard bugs presents.

Rewrote the entire project.

Rewrote the entire project+1

The key in these questions is to cover the fundamentals, and be ready for the back-and-forth with the interviewer. Might be worth doing a mock interview with one of the Agoda or ex-Agoda Senior Android Developer experts on Prepfully? They give real-world practice and guidance, which is pretty helpful. prepfully.com/practice-interviews Less

### Write algorithm to convert number for example 16 138 832 into "sixteen million one hundred thirty eight thousand eight hundred thirty two"

haven't checked leetcode, but how about this? firstly use (int)(Math.log10(number) + 1) to get the number of digits in the given number. (Note: you have to handle 0 differently) e.g 16138832 should return 8. Use this number of digits to get an idea of digit place's spelling (billion, million, thousand, hundred) Then for each digit (0~9) I'm thinking of using the previous answer's suggestion of HashMap to get the spelling. So I imagine there would be two HashMaps, one for getting the digit spelling (one, two, ... nine, ten, ... , nineteen), the other for the digit place spelling (billion, million, thousand, hundred, ... thirty, twenty) Less

Here is the answer. Sorry for the extra spaces :) private static String spellNumber(String number) { HashMap level1Num = new HashMap(); level1Num.put(1, " one "); level1Num.put(2, " two "); level1Num.put(3, " three "); level1Num.put(4, " four "); level1Num.put(5, " five "); level1Num.put(6, " six "); level1Num.put(7, " seven "); level1Num.put(8, " eight "); level1Num.put(9, " nine "); level1Num.put(10, " ten "); level1Num.put(11, " eleven "); level1Num.put(12, " twelve "); level1Num.put(13, " thirteen "); level1Num.put(14, " fourteen "); level1Num.put(15, " fifteen "); level1Num.put(16, " sixteen "); level1Num.put(17, " seventeen "); level1Num.put(18, " eighteen "); level1Num.put(19, " ninteen "); HashMap level2Num = new HashMap(); level2Num.put(2, " twenty "); level2Num.put(3, " thirty "); level2Num.put(4, " fourty "); level2Num.put(5, " fifty "); level2Num.put(6, " sixty "); level2Num.put(7, " seventy "); level2Num.put(8, " eighty "); level2Num.put(9, " ninty "); String output = ""; while (number.length() &gt; 0) { String block; if (number.length() % 3 == 0) { block = number.substring(0, 3); } else { block = number.substring(0, (number.length() % 3)); } if (block.length() &gt; 2) { output += level1Num.get(Integer.parseInt(block.substring(0, 1))) + " hundred "; number = number.replace(block.subSequence(0, 1), ""); block = block.replace(block.subSequence(0, 1), ""); } int block2 = Integer.parseInt(block); if (block2 = 7 &amp;&amp; number.length() = 4 &amp;&amp; number.length() &lt;= 6) { output += " thousand"; } number = number.replace(block, ""); } return output; } Less

It was hard to write under pressure. Basically, I was using HashMap. Key for integer, value for spelling. Solution you can find somewhere at leetcode Less

### How to make a global error class for Retrofit errors?

I answered we can make a generic class for errors which can be used throughout the app. They wanted a specific name. They then answered that we can use GlobalErrorScope for it. It doesn't make sense. You can name it anything internally. Less

Create Kotlin Sealed class that can be used as enum for handling different status Less

### They give a coding repo 2h prior to the interview, we are allowed to make any changes to the code before the interview and add whatever extra code you want

There's quite an extended back and forth in actual interviews for questions like this, so nothing quite like real practice. The Prepfully Gojek Senior Android Developer experts have actually worked in this role, so they're able to do an honest-to-God accurate mock, which really puts you through the paces. prepfully.com/practice-interviews Less

The candidate is expected to write production-quality code in 1.5h live coding round- pagination, dagger/HILT, unit testing, RecyclerView, Clean architecture, and MVVM. No margin for any error allowed. The panel usually consists of petty android developers who completely ignore the time constraint and interview environment. They love playing with their few minutes of power. Less

### 1. Android components 2. App lifecycle. 3. Design pattern

Nothing.

Activity Lifecycle Methods onCreate() Called when activity first created onRestart() Called after activity stopped, prior to restarting onStart() Called when activity is becoming visible to user onResume() Called when activity starts interacting with user onPause() Called when a previous activity is about to resume onStop() Called when activity no longer visible to user onDestroy() Final call received before activity is destroyed ----------------- Creational patterns: Builder (e.g. AlertDialog.Builder) Dependency Injection (e.g. Dagger 2) Singleton Structural patterns: Adapter (e.g. RecyclerView.Adapter) Facade (e.g. Retrofit) Behavioral patterns: Command (e.g. EventBus) Observer (e.g. RxAndroid) Model View Controller Model View ViewModel (similar to the MVC pattern above) Less

### How the viewpager is implemented?

When a fragment is loaded, the next one and the previous one are in cache.

Add in xml , create adapter , send fragments instance to adapter instance , the viewpager will show fragments by order Less

### What is Dependency injection

Resuming... DI is a technique whereby one object supplies the dependencies of another object. Dagger 2 is the well know compile-time framework for dependency injection in Android. Less

DI is a technique whereby one object supplies the dependencies of another object. Dagger 2 is the well know compile-time framework for dependency injection in Android. Less

### when working different threat than main threat which androi api do you use ?

Handler

It depends , you can use AsyncTask as well.