Androidのパフォーマンス最適化には、UIスレッドの応答性を保つこと、効率的なメモリ使用(リークの回避)、滑らかなレンダリング、効率的なリスト処理、そしてボトルネックを見つけるためのプロファイリングが含まれます。パフォーマンスはユーザー体験に直接影響し、多様なAndroidデバイスの範囲全体で重要です。
UIスレッド(メインスレッド)の応答性を保つ
✓ NEVER block the main thread → do network/DB/heavy work OFF it (coroutines + Dispatchers.IO)
→ blocking causes jank or ANR ("App Not Responding") — a top issue
✓ Keep work in onCreate / onBind / on the main thread minimal and fast
メモリとリーク
✓ Avoid MEMORY LEAKS — a common Android problem:
→ don't hold Activity/Context references beyond their lifecycle (a classic leak)
→ unregister listeners/observers; use lifecycle-aware components; cancel coroutines
→ use tools like LeakCanary to detect leaks
✓ Manage bitmaps/images carefully (large memory); use image libraries (Glide, Coil)
