The ULTIMATE Guide to Sharing Data Between Screens in Jetpack Compose

The ULTIMATE Guide to Sharing Data Between Screens in Jetpack Compose

Philipp Lackner

1 год назад

53,329 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Shivam
Shivam - 19.09.2023 09:35

Helpful as always, Thanks!

Ответить
Siamak Ashrafi
Siamak Ashrafi - 03.09.2023 02:48

Nice. Very clear 🙂

Ответить
tuyul ghost
tuyul ghost - 31.08.2023 03:58

your english so fast, please make it slow

Ответить
Vinaykumar Patel
Vinaykumar Patel - 28.08.2023 18:34

In my current organization we use Singletons inside Repository to share users login data between different viewmodels, and they never experience any issue with that. I still don't understand why are you saying to avoid using Singleton classes to share data between. It is usuful when we need to access user's details in different pages.

Ответить
Hung Nguyen
Hung Nguyen - 13.06.2023 04:16

how to properly share with activity please tell me

Ответить
Victor Farkas
Victor Farkas - 10.06.2023 19:22

what about Preferences DataStore?

Ответить
Vengatesh M
Vengatesh M - 04.06.2023 16:17

Hi Phillip,
Can we have shared viewmodel and individual viewmodel for on one onboarding screen composable at same time?

Ответить
Moises Valera
Moises Valera - 31.05.2023 04:10

In SharedViewModel approach, how can I reset the viewModel once I leave "personal_details" route?, it's always loading previous data onceI got back into it again.

Ответить
Johan Albrectsen
Johan Albrectsen - 29.05.2023 18:56

I'm sharing a viewModel between a regular composable and a sheet, but the UI doesn't update when I change the sharedState in the viewModel from the sheet. How can I make it recompose when the value in the viewModel is updated?

Ответить
Nour Morgan
Nour Morgan - 29.05.2023 00:06

Hey Philipp , what about using compose destinations ?

Ответить
Sean Knowles
Sean Knowles - 28.05.2023 18:17

In what order shall we take all your courses?!

Ответить
Skajp203
Skajp203 - 21.05.2023 16:16

I like using raamcosta destinations for compose, it really makes things easy. It alow passing data between @Composable's, but after this I can initialize my ViewModel with the value.

Ответить
Phúc Nguyễn
Phúc Nguyễn - 20.05.2023 07:01

Hi Philipp, I have a question about docker. Do we (android dev) need to learn docker or it just nice to know

Ответить
Iacov Colisnicenco
Iacov Colisnicenco - 19.05.2023 21:29

It seems to me that data binding in xml layout projects is easy, but it more hell then compose

Ответить
Rahul Kumar Abhishek
Rahul Kumar Abhishek - 19.05.2023 10:10

How to send parcelable object to start destination

Ответить
Saeid Honardan | سعید هنردان
Saeid Honardan | سعید هنردان - 19.05.2023 09:00

It is great that put the source code of the video. thanks

Ответить
John
John - 19.05.2023 06:53

Thanks

Ответить
Sean Oh
Sean Oh - 19.05.2023 00:44

Another "con" of using navigation arg is that you need to make sure the string is URL encoded. I said con with quotes because you can handle this pretty easily, but sometimes you forget to do that and can spend significant of time to find out why something isn't working as expected.

Ответить
SEANNA TV • 셔나 TV
SEANNA TV • 셔나 TV - 19.05.2023 00:43

Another "con" of using navigation arg is that you need to make sure the string is URL encoded. I said con with quotes because you can handle this pretty easily, but sometimes you forget to do that and can spend significant of time to find out why something isn't working as expected.

Ответить
Keval Kanpariya
Keval Kanpariya - 18.05.2023 14:48

Please make video on Oauth2 Authentication with Webview using Jetpack compose

How the CallBackUrl retrieved from the api and retrieve access token to make api calls.

Ответить
Mikhail
Mikhail - 18.05.2023 14:27

I am using hilt view model with compose destinations, pretty neat

Ответить
Huddah Huddah
Huddah Huddah - 18.05.2023 12:35

Im still hard to understand navigation in compose :(

Ответить
IT'SJee
IT'SJee - 18.05.2023 10:32

Can we share complex object data without using SharedViewModel ?

Ответить
Emmanuel Mtera
Emmanuel Mtera - 18.05.2023 09:47

On the last option is using sqDelight a choice for Kotlin Multiplatform Mobile?

Ответить
Craig Berry
Craig Berry - 18.05.2023 01:41

Hi Philipp, first thank you for the great tutorials.I have a question if you have time?

In the last (persistent storage) example, if we want to clear the session every time the application is closed / destroyed, but we want the session to persist through the lifetime of the app, where is the appropriate place to clear it? Isn't onDestroy() called sometimes during process death?
Thank you again!

Ответить
Tomás Dias
Tomás Dias - 18.05.2023 00:54

Hi Philipp. Very helpful video as always. I have a question: why are you using shared preferences instead of data store?

Ответить
ei baal
ei baal - 17.05.2023 20:17

When you try jetpack compose multiplataform ?

Ответить
E Fefer
E Fefer - 17.05.2023 19:22

does passed intent arguments survive process death?

Ответить
Amr el-tahhan
Amr el-tahhan - 17.05.2023 18:48

I really love the way you demonstrate thing ♥
but I think you should add the video to the compose playlist so we can find it easily

Ответить
arielapp
arielapp - 17.05.2023 17:15

I wish there was a better way of writing jetpack navigation better :\
anyway thank you for this lovely guide.
is there a difference between @Singleton and object in kotlin?

Ответить
Nickolay Unuchek
Nickolay Unuchek - 17.05.2023 16:36

Where is settings to show option for Terminate Application?

Ответить
Nickolay Unuchek
Nickolay Unuchek - 17.05.2023 16:33

How to restore state of FirstScreen if we click on Back btn at SecondScreen?

Ответить
Mubashir P A
Mubashir P A - 17.05.2023 16:29

How to pass data to the previous screen
Eg: I have two screen first screen is to show the list of some items from database and second screen is used to create an item. When I create an item from the second screen I want close that screen and show the updated list in the first screen

Ответить
Андрей
Андрей - 17.05.2023 16:24

how can I pass nullable value? for example, I need to pass Long (as LocalDateTime), and sometime this value can be nullable. If I pass null for that value, my application is crashing, because it's an exception about wrong navigation, can't find route

Ответить
Ajith M
Ajith M - 17.05.2023 16:09

One question, why do we have to redeclare a new mutable state in viewmodel and assign it to original stateflow. Is there any issue if create a stateflow in viewmodel and directly access it from composables? As long as i make sure that i am not writing anything to the state, is it fine?
Ref: private val val sharedState = MutableStateFlow( value: 0)
sharedState = _sharedState.asStateFlow)

Ответить
Danil Sveticov
Danil Sveticov - 17.05.2023 16:08

Thanks

Ответить
legato0
legato0 - 17.05.2023 15:10

Thanks for sharing your knowledge 👍. As a beginner, I always used the first option to pass parameters between views. Now I can start testing different ways 😄

Ответить
Siyabulela Shabalala
Siyabulela Shabalala - 17.05.2023 14:48

Hi Philipp, love your videos. I have a question here, in your few previous videos you use raamcosta library as a navigation tool and lately I've seen you stop using it and I saw it also seems to provide an easy way to share data since it can share reference data. What disadvantage you discovered that made you stop using it?

Ответить
ADAM
ADAM - 17.05.2023 14:14

Hello Mr.Pilipp
Could you make an app with multi-module and navigation, and the app consists of two types of user.
Thanks a lot 🤍

Ответить
Andro Dev
Andro Dev - 17.05.2023 14:12

How can we make favorite item to database and when colse app and run it again the fav button will be active based on database ?

Ответить
Maciej Łojek
Maciej Łojek - 17.05.2023 14:12

That's exactly what I needed! Thanks a lot

Ответить
chathuranga muthukuda
chathuranga muthukuda - 17.05.2023 13:48

How can we share a value between main activity and a compose secreen in a different feature module..value is defined in main acitivity and i want to get it from the composable

Ответить
The Dark Knight
The Dark Knight - 17.05.2023 13:40

I use bundle

Ответить
Mahmoud alkateb
Mahmoud alkateb - 17.05.2023 13:37

🎉

Ответить