Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Android Intents using Dart & Henson
Search
Diego Velásquez
August 20, 2017
Programming
100
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
78
Stateful & Async Widgets
diegoveloper
0
110
Bienvenido a Flutter
diegoveloper
0
69
Beautiful apps in record time with Flutter
diegoveloper
0
58
Hello Flutter - Beautiful apps in record time
diegoveloper
0
150
Introducción a Flutter
diegoveloper
1
200
Flutter y el impacto en el mercado actual de apps móviles
diegoveloper
0
150
Let's start with Flutter
diegoveloper
0
85
Hello Flutter!
diegoveloper
0
160
Other Decks in Programming
See All in Programming
外から家のPCの電源入れたい!をPHPで解決する
kawashimo0
1
130
なぜCTOを降りてFDEを選んだのか?〜なぜプロダクト企業がFDEで顧客の現場に踏み込むのか〜
gonta
1
210
IBM Bob Dojo #1 仕様駆動開発入門
oniak3ibm
PRO
0
390
AIに “答え“を書かせるのを やめてみた
___akari11
0
120
Next.js: The final boss of Web Performance
guaca
0
260
自サークルのIdPからログアウトできるようになるまで
taiseiue
1
140
作って学ぶSpring BootのAuto Configuration / JJUG Night Seminar 2026-10-19
rshindo
0
150
動作中のプログラムの中身をリアルタイムに覗く / Realtime Debugger for CSharp with Roslyn
prota
1
1.9k
C#の現在地 進化の歴史と、AI時代の.NET Everywhere
neuecc
5
5.2k
IBM Bob でAI駆動開発『QC-Playbook』
ichirokano2
0
110
現場と育てるRailsモデリング 〜Spreadsheetから始めたモデル設計〜
siroemk
2
590
AIで開発が速くなった先で、開発チームは何を目指すか
shihochan
0
1.2k
Featured
See All Featured
Paper Plane (Part 1)
katiecoart
PRO
2
12k
Making Projects Easy
brettharned
120
6.8k
New Earth Scene 8
popppiees
4
2.7k
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
750
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
1k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
630
Testing 201, or: Great Expectations
jmmastey
46
8.3k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.5k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
570
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.2k
How to make the Groovebox
asonas
2
2.5k
Automating Front-end Workflow
addyosmani
1369
210k
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]