Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
What The Context ?
Search
Adnan A M
April 11, 2020
Programming
240
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
What The Context ?
Slides from my talk at BLRDroid
Adnan A M
April 11, 2020
More Decks by Adnan A M
See All by Adnan A M
Abridge Coding Guidelines
adnan321
0
74
A developer's guide to wealth
adnan321
0
290
What the Hook ?
adnan321
0
100
Scoping Your Storage
adnan321
2
190
Putting Work Manager To Work
adnan321
0
120
OOP To FP
adnan321
1
220
Putting Work Manager To Work
adnan321
1
190
A slice of Android Slices - droidcon London 2018
adnan321
0
130
Having fun with Kotlin fun()
adnan321
0
120
Other Decks in Programming
See All in Programming
Developing with AI Agents — Codex, Claude Code & Cowork Practical Guide
x5gtrn
PRO
0
1.3k
Performance Engineering for Everyone
elenatanasoiu
0
250
act1-costs.pdf
sumedhbala
0
160
LLMによるContent Moderationの本番運用の裏側と品質担保への挑戦
suikabar
3
820
Snowflake Summitでの新機能 CoCo / CoWork / snowflake-summit-2026-overall-what-new-coco
tatsuhiro
1
210
Javaの型とAI時代に型が大事な理由 / java types and type in AI era
kishida
2
170
エンジニアと一緒にテストコードの設計と実装を改善した話
mototakatsu
0
250
AIキャラアプリkaiwaの低遅延音声通話基盤をどう作ったか - AWS Gravitonで支える低遅延・低コストAI Agent基盤
mogamit
0
150
「AIで開発し、AIを届ける」をEvalでつなぐ 〜AIネイティブに始めるプロダクト開発の実践〜 / Connecting "Develop with AI, deliver AI" with Eval
rkaga
4
5.6k
Signal Forms: Details & Live Coding @enterJS 2026 in Mannheim
manfredsteyer
PRO
0
210
なぜ型を書くのか? TSKaigi2026で改めて考える #tskaigi_smarthr
kajitack
0
190
AI駆動開発を妨げる技術的負債の解消アプローチ / ai-refactoring-approach
minodriven
17
8.6k
Featured
See All Featured
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
310
A Soul's Torment
seathinner
6
3k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2k
Typedesign – Prime Four
hannesfritz
42
3.1k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
1
3.7k
30 Presentation Tips
portentint
PRO
1
340
How to train your dragon (web standard)
notwaldorf
97
6.7k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.4k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Designing for humans not robots
tammielis
254
26k
SEO for Brand Visibility & Recognition
aleyda
0
4.6k
Product Roadmaps are Hard
iamctodd
55
12k
Transcript
W at he on ex B d 1
Context ?!?? C nt xt s ur m gi !
— Adnan A M B d 2
W y o n ed on ex ? ✴ g
u () ✴ g t () ✴ g e c () ✴ g () ✴ s X() -> S n c n (A y, S , B s e ) B d 3
Types of Context ✴ A t C ✴ A y
C ✴ B C ✴ T C ✴ t ✴ t B d 4
A tu l yp s f on ex ✴ U
C ✴ N -U C B d 5
Understanding the Hierarchy Context | Context Wrapper +-----------+---------+ | |
| Application Service ContextThemeWrapper | Activity B d 6
Understanding the Hierarchy ✴ C /C W ---> o C
✴ C T a -> C = C + T B d 7
UI Context Context + Your Theme B d 8
UI Context ✴ A y - i (I e a
y) ✴ F t - g e () ✴ V - g e () B d 9
Non UI Context ✴ A y - g i C
() ✴ S - g i C () / i (I e s ) ✴ C - g i C () ✴ B s R r - C p B d 10
Does it Matter ? My functionality works fine with either
\0/ B d 11
Which Context to Use ? B d 12
Application Context ✴ S o I e w h m
p ✴ g i C () ✴ N C (L L ) B d 13
Activity/Service Context ✴ U I e e a y/s ✴
t ✴ A y C - C ✴ S C - o C B d 14
Broadcast Receiver Context ✴ U I e e c ✴
c p a t ✴ N C ✴ Y e a R r c t w a r r e () n b v () d d B d 15
Base Context ✴ T d e i n h C
✴ C e l c ✴ C o d u a a e () h C W B d 16
getContext() It Depends \0/ B d 17
What #1 !!! ??? val intent = Intent(this, TestActivity::class.java) applicationContext.startActivity(intent)
B d 18
What #2 !!! ??? class SimpleSingleton { private static SimpleSingleton
sInstance; private Context mContext; public static SimpleSingleton getInstance(Context context) { if (sInstance == null) { sInstance = new SimpleSingleton(context); } return sInstance; } private SimpleSingleton(Context context) { mContext = context; } } B d 19
What #3 !!! ??? LayoutInflater.from(applicationContext).inflate( R.layout.progress_bar, parent, false ) B
d 20
Oh Wow #1 !!! val contextThemeWrapper = ContextThemeWrapper(this, R.style.YOUR_THEME) val
builder = AlertDialog.Builder(contextThemeWrapper) builder.show() B d 21
Sidenote val contextThemeWrapper = ContextThemeWrapper(this, R.style.YOUR_THEME) getBaseContext() ---> Returns instance
of this B d 22
Oh Wow #2 !!! val configuration = resources.configuration configuration.setLocale(your_custom_locale) context
= createConfigurationContext(configuration) B d 23
Oh Wow #3 !!! LayoutInflater.from(applicationContext).inflate( R.layout.progress_bar, parent, false ) B
d 24
Deciding Between UI & Non UI Context ✴ D o
e a r s ? --> C ✴ L L o O o --> o C ✴ N r ? --> B t o C B d 25
References ✴ W C S I s - l M
a ✴ M n A C - G K ✴ C , a C - v S B d 26
T an Y u ! B d 27