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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Adnan A M
April 11, 2020
Programming
2
230
What The Context ?
Slides from my talk at BLRDroid
Adnan A M
April 11, 2020
Tweet
Share
More Decks by Adnan A M
See All by Adnan A M
Abridge Coding Guidelines
adnan321
0
62
A developer's guide to wealth
adnan321
0
270
What the Hook ?
adnan321
0
92
Scoping Your Storage
adnan321
2
170
Putting Work Manager To Work
adnan321
0
110
OOP To FP
adnan321
1
210
Putting Work Manager To Work
adnan321
1
170
A slice of Android Slices - droidcon London 2018
adnan321
0
120
Having fun with Kotlin fun()
adnan321
0
97
Other Decks in Programming
See All in Programming
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
310
AIとペアプロして処理時間を97%削減した話 #pyconshizu
kashewnuts
1
170
AIによる開発の民主化を支える コンテキスト管理のこれまでとこれから
mulyu
3
2.2k
AIエージェントのキホンから学ぶ「エージェンティックコーディング」実践入門
masahiro_nishimi
7
1.2k
並行開発のためのコードレビュー
miyukiw
2
2.1k
Head of Engineeringが現場で回した生産性向上施策 2025→2026
gessy0129
0
200
「ブロックテーマでは再現できない」は本当か?
inc2734
0
1.1k
あなたはユーザーではない #PdENight
kajitack
4
290
Swift ConcurrencyでよりSwiftyに
yuukiw00w
0
220
朝日新聞のデジタル版を支えるGoバックエンド ー価値ある情報をいち早く確実にお届けするために
junkiishida
1
290
15年目のiOSアプリを1から作り直す技術
teakun
0
570
Agent Skills Workshop - AIへの頼み方を仕組み化する
gotalab555
13
7.4k
Featured
See All Featured
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
270
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
110
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
360
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
280
Navigating Team Friction
lara
192
16k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
300
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
140
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
0
150
Balancing Empowerment & Direction
lara
5
920
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.4k
エンジニアに許された特別な時間の終わり
watany
106
240k
Raft: Consensus for Rubyists
vanstee
141
7.3k
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