Why is it important to keep heavy work off the main thread in a mobile app, and what kinds of work belong on a background thread?

technical-conceptual · Junior level · software-engineering

What the interviewer is really asking

Assesses whether the candidate understands that the UI thread renders frames and handles input, so blocking it causes visible jank or ANRs, and can identify what work to move off it.

What to say

What to avoid

Example answers

Strong: The main thread draws frames and handles taps, and it only has about 16ms per frame at 60fps. If I do a network call or decode a large image on it, that work blows the budget, frames drop, and the screen stutters. So I run I/O, parsing, and image decoding on a background dispatcher or executor and only switch back to the main thread to update the UI.

Weak: You should always use background threads because threads make things faster. I'd put as much as possible on other threads so the app runs in parallel and stays quick.

Want questions matched to your role? Paste a job title, job description, or CV and get a personalized set, or go Pro to unlock the full bank.