Navigation: SafeArgs - MAD Skills

  Рет қаралды 18,194

Android Developers

3 жыл бұрын

Welcome to the third episode in the Navigation series. In this video, Chet Haase will talk about SafeArgs, a gradle plugin that takes information about the arguments you want to pass to navigation destinations and generates code - just for you.
Donut Tracker sample code → goo.gle/378Hm38
Getting started guide → goo.gle/3dgXFfa
Catch more on Navigation for MAD Skills → goo.gle/navigation-mad
Watch more MAD Skills episodes → goo.gle/madskills
Subscribe to Android Developers → goo.gle/AndroidDevs
#Navigation #SafeArgs #MADSkills

Пікірлер: 31
@jarar198619
@jarar198619 3 жыл бұрын
thanks, very concise implementation!
@_sharmaji.dev_
@_sharmaji.dev_ 3 жыл бұрын
Thanks for this.✨✨
@omarmaq6878
@omarmaq6878 3 жыл бұрын
Best of the best.
@zeno921
@zeno921 3 жыл бұрын
Perhaps this will be addressed in a future video, but at the moment this doesn't properly handle configuration changes. In other words, if you tap to edit a donut, make some changes without saving, and then rotate the device, the changes will be lost. I would usually handle this by only calling ".get" on the view model when savedInstanceState is null, but I'm curious if there's another recommended way.
@lecturesoniesgatepreparati8554
@lecturesoniesgatepreparati8554 3 жыл бұрын
Great
@port443p
@port443p 3 жыл бұрын
Nice. New shiny feature forcing 30-year-old-C-style magic numbers. Especially, when underlying transport (Bundle) allows to avoid it...
@ImamSyafii-st4ps
@ImamSyafii-st4ps 3 жыл бұрын
can you explain it a bit more?
@gi1dor
@gi1dor 3 жыл бұрын
@@ImamSyafii-st4ps instead of avoiding pass this param (which possible with Bundle), so it will be clear that it not present there, -1 passed which is a magic number with some special semantics, which easy to misuse.
@robchr
@robchr 3 жыл бұрын
I use inline classes for my database ids. Does SafeArgs provide a way to use inline classes for primitive types?
@ack_
@ack_ 3 жыл бұрын
You're making my days
@layly7961
@layly7961 3 жыл бұрын
guys I can't generate direction class. Can you help me to solve this problem?
@movieclips7511
@movieclips7511 Жыл бұрын
@@layly7961 did you solve it? i run in the same problem
@giovanniminelli5590
@giovanniminelli5590 3 жыл бұрын
DonutEntryDialogFragment line 60, suold be >=0?
@SpectatorAlius
@SpectatorAlius 2 жыл бұрын
He just talked about Bundles, somehow that reminded me: we used Bundles for a very similar purpose with Intents and even then I noticed: you read the documenataion on Bundles and see: they aer designed for inter process communication. But Activities and Fragments in the same application are usually in the same process. So why do we need the full weight of inter process communication? We should be able to use something more lightweight, but not even SafeArgs will finally fix that for us.
@OhhhThatVarun
@OhhhThatVarun 3 жыл бұрын
I love this guy!
@codinginflow
@codinginflow 3 жыл бұрын
magical
@abhimanyu.n14
@abhimanyu.n14 3 жыл бұрын
@android developers The recommendation is to use activity viewmodel to share large data between fragments and nav args for sharing less data between fragments. How to determine when to use which one? Any parameter to check when we should switch from navargs to activity viewmodel?
@RinoSss
@RinoSss 3 жыл бұрын
Maybe if you have a list of O(N) objects it's better to share this through a viewmodel
@JACOBMOULTy
@JACOBMOULTy 3 жыл бұрын
First! JK. This video was short and to the point on how to use a powerful tool. Gives a great base.
@thetekkitrealm4863
@thetekkitrealm4863 3 жыл бұрын
Please tell me name for advanced Android book
@chrislagos44
@chrislagos44 2 жыл бұрын
How to pass a dynamic argument inside a deep link? Will use the Facebook SDK sharing functionality to deep link into my own app. User A which has my app installed shares an ad for my app to a Facebook friend via the Facebook SDK. Inside the ad is the deep link that will trigger the friend (who does not have the app installed) to download it from Play Store. Upon opening the app for first time, the deep link will take the new user to a fragment within the app. However, I need to pass an argument so this fragment will display accordingly. How can I do this??
@scottbiggs8894
@scottbiggs8894 Жыл бұрын
What was that window that popped up at 3:51? It looks very useful--how do you bring it up?
@Tuligarnio
@Tuligarnio Жыл бұрын
On Windows it is Ctrl + E
@parjoloid9285
@parjoloid9285 3 жыл бұрын
Mantap
@parjoloid9285
@parjoloid9285 3 жыл бұрын
Good
@doomii
@doomii 3 жыл бұрын
To be honest I really don't like the navigation stuf, and this, IMHO, is much more complicated than a basic companion function to create a fragment instance with a basically created bundle.
@hamzabouziidi5903
@hamzabouziidi5903 3 жыл бұрын
This solves the fact of having instances of fragments in memory for each navigation when working with bundles
@gi1dor
@gi1dor 3 жыл бұрын
@@hamzabouziidi5903 You don't need navigation component to avoid it, it already handled by fragment manager
@movieclips7511
@movieclips7511 Жыл бұрын
I am new to programming and this gradle thing make me suicide. why the programmer need to add different code, then stuck that graddle gives error. shouldn't the android studion be smart enough to add the necessary?
@saidkamol3284
@saidkamol3284 2 жыл бұрын
I am sure in bumblebee it doesn`t work like that
@chrislagos44
@chrislagos44 2 жыл бұрын
this looks ten times more complicated than the old Bundle way!! getInt() , getLong() why does Android complicate code and processes so much!
DO YOU HAVE FRIENDS LIKE THIS?
00:17
dednahype
Рет қаралды 99 МЛН
LOVE LETTER - POPPY PLAYTIME CHAPTER 3 | GH'S ANIMATION
00:15
50 YouTubers Fight For $1,000,000
41:27
MrBeast
Рет қаралды 95 МЛН
ТАМАЕВ УНИЧТОЖИЛ CLS ВЕНГАЛБИ! Конфликт с Ахмедом?!
25:37
1$ vs 500$ ВИРТУАЛЬНАЯ РЕАЛЬНОСТЬ !
23:20
GoldenBurst
Рет қаралды 1,7 МЛН
Cheapest gaming phone? 🤭 #miniphone #smartphone #iphone #fy
0:19
Pockify™
Рет қаралды 2,1 МЛН
⚡️Супер БЫСТРАЯ Зарядка | Проверка
1:00
Todos os modelos de smartphone
0:20
Spider Slack
Рет қаралды 7 МЛН
После ввода кода - протирайте панель
0:18
Up Your Brains
Рет қаралды 1,2 МЛН
Здесь упор в процессор
18:02
Рома, Просто Рома
Рет қаралды 324 М.