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
Android Intents using Dart & Henson
Search
Diego Velásquez
August 20, 2017
Programming
96
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Android Intents using Dart & Henson
Diego Velásquez
August 20, 2017
More Decks by Diego Velásquez
See All by Diego Velásquez
Flutter: Don't be afraid, State Management is your friend
diegoveloper
2
73
Stateful & Async Widgets
diegoveloper
0
110
Bienvenido a Flutter
diegoveloper
0
66
Beautiful apps in record time with Flutter
diegoveloper
0
57
Hello Flutter - Beautiful apps in record time
diegoveloper
0
140
Introducción a Flutter
diegoveloper
1
200
Flutter y el impacto en el mercado actual de apps móviles
diegoveloper
0
140
Let's start with Flutter
diegoveloper
0
81
Hello Flutter!
diegoveloper
0
160
Other Decks in Programming
See All in Programming
【SRE NEXT 2026 Lunch Session】一人目専任SREの立ち上げを加速する ― AIと進めたオンボーディングで2分を0.04秒にした話
pkshadeck
PRO
0
3.3k
メールのエイリアス機能を履き違えない
isshinfunada
0
150
生成AI導入の「期待外れ」を乗り越える ー 開発フロー改革が目指す、真の組織変革
starfish719
0
2.7k
言語を使う側から、作る側へ。 自作 Lisp で得た新たな気づき。
andpad
0
140
変わらないものが、変わるものを決める — 意図駆動開発 × イベントソーシング × イミュータブル | What Doesn't Change Decides What Can — IDD × Event Sourcing × Immutability
tomohisa
0
700
yield再入門 #phpcon
o0h
PRO
0
820
使用 Meilisearch 建立新聞搜尋工具
johnroyer
0
190
その節約、円になってますか?
isamumumu
0
490
琵琶湖の水は止められてもNet--HTTPのリトライは止められない / You might be able to stop the water flow of Lake Biwa but you can't stop Net::HTTP retries
luccafort
PRO
0
480
複数の Claude Code が"放置"されてしまう問題をCLI ダッシュボードを自作して解決した話
sumihiro3
0
530
Prismを使った型安全な暗号化_関数型まつり2026
_fhhmm
0
150
Laravelで学ぶ Webアプリケーションチューニング入門/web_application_tuning_101
hanhan1978
4
1.4k
Featured
See All Featured
Context Engineering - Making Every Token Count
addyosmani
9
1k
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
118
120k
Git: the NoSQL Database
bkeepers
PRO
432
67k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.5k
Why Our Code Smells
bkeepers
PRO
340
58k
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Everyday Curiosity
cassininazir
0
270
YesSQL, Process and Tooling at Scale
rocio
174
15k
Tell your own story through comics
letsgokoyo
1
1k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.7k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.4k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.9k
Transcript
Android Intents with Dart & Henson Diego Velasquez Android Developer
Belatrix SF @diegoveloper
Intents An intent is an abstract description of an operation
to be performed. Activity Broadcast Receiver Service Intent
Have not specified a component; instead declare a general action
to perform, which allows a component from another app to handle it Intent types Have specified a component which provides the exact class to be run. Implicit Explicit
Intent intent = new Intent( this, DetailActivity.class); startActivity(intent); Explicit Intent
MainActivity.class DetailActivity.class
Creating & Consuming Intents public static final String INTENT_PARAM =
"param_name"; ... Intent intent = new Intent( this, DetailActivity.class); intent.putExtra(INTENT_PARAM, "Android"); startActivity(intent); public static final String INTENT_PARAM = "param_name"; ... Intent intent = getIntent(); if (intent != null && intent.hasExtra(INTENT_PARAM)){ String name = getIntent().getStringExtra(INTENT_PARAM); }
What do we do? public static void startDetailActivity(Context context, String
param1, String param2){ Intent intent = new Intent(context, DetailActivity.class); intent.putExtra("PARAM_1", param1); intent.putExtra("PARAM_2",param2); context.startActivity(intent); } public static void startDetailActivity(Context context, String param1){ Intent intent = new Intent(context, DetailActivity.class); intent.putExtra("PARAM_1", param1); context.startActivity(intent); } public static void startDetailActivity(Context context, String param1, String param2){ Intent intent = new Intent(context, DetailActivity.class); if (param1 != null) intent.putExtra("PARAM_1", param1); if (param2 != null) intent.putExtra("PARAM_2",param2); context.startActivity(intent); } public static void startDetailActivity(Context context, String param1){ startDetailActivity(context, param1,null); } Refactoring
Dart & Henson Android dependency Injection library to deal with
Intent data passing
Dart: Consuming Intents DetailActivity.java @InjectExtra String paramName; … @Override protected
void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_detail); Dart.inject(this); }
Dart: Features @InjectExtra String paramName; @InjectExtra User user; @InjectExtra("quantity") int
quantityValue; @InjectExtra boolean isSuccess = false; @Nullable @InjectExtra String anotherValue; public class DetailModel { @InjectExtra String valueModel; public String getValueModel() { return valueModel; } } DetailActivity.java DetailModel model = new DetailModel(); …. @Override protected void onCreate(Bundle savedInstanceState) { …. Dart.inject(model,this); String ourValue = model.getValueModel(); }
Dart: Set Up build.gradle compile 'com.f2prateek.dart:dart:2.0.2' provided 'com.f2prateek.dart:dart-processor:2.0.2'
Henson: Creating Intents @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); Intent intent = Henson.with(this).gotoDetailActivity().paramName("Test value").build(); startActivity(intent); }
Henson: Features Intent intent = Henson.with(this).gotoDetailActivity() .isSuccess(true) .paramName("Test") .quantity(5) .user(new
User()) .build(); startActivity(intent); @HensonNavigable(model = DetailModel.class) public class DetailActivity extends AppCompatActivity { DetailModel model = new DetailModel(); …. @Override protected void onCreate(Bundle savedInstanceState) { …. Dart.inject(model,this); } Intent intent = Henson.with(this).goToDetailActivity().valueModel("testing").build(); startActivity(intent);
Henson: Set Up build.gradle compile 'com.f2prateek.dart:henson:2.0.2' provided 'com.f2prateek.dart:henson-processor:2.0.2'
Place your screenshot here Let’s code
References ▪ Intents: https://developer.android.com/guide/components/intents-filters.html ▪ Dart & Henson: https://github.com/f2prateek/dart
Thanks! Any questions? You can find me at ▪ https://github.com/diegoveloper
▪
[email protected]