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
2
220
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
53
A developer's guide to wealth
adnan321
0
260
What the Hook ?
adnan321
0
89
Scoping Your Storage
adnan321
2
160
Putting Work Manager To Work
adnan321
0
100
OOP To FP
adnan321
1
200
Putting Work Manager To Work
adnan321
1
160
A slice of Android Slices - droidcon London 2018
adnan321
0
110
Having fun with Kotlin fun()
adnan321
0
96
Other Decks in Programming
See All in Programming
ビルドプロセスをデバッグしよう!
yt8492
0
310
Kotlinで実装するCPU/GPU 「協調的」パフォーマンス管理
matuyuhi
0
410
詳細の決定を遅らせつつ実装を早くする
shimabox
1
1.2k
Kotlin + Power-Assert 言語組み込みならではのAssertion Library採用と運用ベストプラクティス by Kazuki Matsuda/Gen-AX
kazukima
0
110
Atomics APIを知る / Understanding Atomics API
ssssota
1
150
ネストしたdata classの面倒な更新にさようなら!Lensを作って理解するArrowのOpticsの世界
shiita0903
1
440
複数チーム並行開発下でのコード移行アプローチ ~手動 Codemod から「生成AI 活用」への進化
andpad
0
170
Stay Hacker 〜九州で生まれ、Perlに出会い、コミュニティで育つ〜
pyama86
2
1.5k
PHPライセンス変更の議論を通じて学ぶOSSライセンスの基礎
matsuo_atsushi
0
150
SUZURIの規約違反チェックにおけるクリエイタフィードバックの試⾏錯誤/Trial and Error in Creator Feedback for SUZURI's Terms of Service Violation Checks
ae14watanabe
1
150
퇴근 후 1억이 거래되는 서비스 만들기 | 내가 AI를 사용하는 방법
maryang
2
570
例外処理を理解して、設計段階からエラーを見つけやすく、起こりにくく #phpconfuk
kajitack
12
6.1k
Featured
See All Featured
Building Adaptive Systems
keathley
44
2.8k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.2k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
33
1.8k
Designing for Performance
lara
610
69k
Designing Experiences People Love
moore
142
24k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.1k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
31
2.7k
Fireside Chat
paigeccino
41
3.7k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Product Roadmaps are Hard
iamctodd
PRO
55
12k
Mobile First: as difficult as doing things right
swwweet
225
10k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
9.7k
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