Code Room
Vibe codingMediumvc-g242
Subject Ai code reviewLevel Mid–Senior~15 minCommon in Concurrency interviewsIndustries Software development

Question

An AI generated this Android settings-screen code to read a config file and JSON-decode it before showing the UI. It works on the emulator, but QA reports the screen freezes for ~1s on older devices and you get ANR reports in production. What's wrong and how would you catch it?

kotlin
override fun onCreate(savedInstanceState: Bundle?) {    super.onCreate(savedInstanceState)    setContentView(R.layout.activity_settings)    val file = File(filesDir, "settings.json")    val text = file.readText()                       // reads on main thread    val config = Gson().fromJson(text, Config::class.java)    bindUi(config)}
What a strong answer looks like

Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it — tests, edge cases, reading critically — and how you’d re-prompt or decompose to get it right.

Describe your solution

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.