Fragments with Jetpack Compose (Interoperability)

Поділитися
Вставка
  • Опубліковано 30 вер 2024
  • The BEST android courses in the world: codingwithmitc...
    This is an example of how to use Fragments with Jetpack Compose. This video is all about interoperability when it comes to jetpack compose. We use ComposeView and a pre-existing xml layout to inflate a composable. You can inflate any custom view (including a google map) as a Composable using this method.
    HorizontalProgressBar: github.com/mit...
    Code: github.com/mit...
    Follow me:
    Instagram: / codingwithmitch
    Twitter: / mitch_tabian
    .
    .

КОМЕНТАРІ • 262

  • @TheKamble
    @TheKamble 3 роки тому +44

    I really want to see a day in android development when we don't have to keep switching to new stuff every two months, anyways, thanks for the awesome video @Mitch, here's your engagement

    • @abhisheksharma8374
      @abhisheksharma8374 2 роки тому +2

      Finally someone who said this!

    • @pcprincipal345
      @pcprincipal345 Рік тому

      @@abhisheksharma8374 Your name and surname are combinations of name and surname of two Indian I know from work.

  • @mehulbisht9708
    @mehulbisht9708 3 роки тому +18

    Me: Wish i had something easy to build layouts like flutter but in native android
    Compose: hello there

  • @deniszpop394
    @deniszpop394 3 роки тому +2

    Hey Mich compose, I didn't like the videos
    I LOVED THEM :wink: :wink:

  • @ayoubmazrou8800
    @ayoubmazrou8800 3 роки тому +7

    thanks a lot for this tutorial

  • @AdWit
    @AdWit 3 роки тому +1

    ContextAmbient and AmbientContext was deprecated
    Replace them with
    LocalContext.current

  • @truepicksyt3323
    @truepicksyt3323 3 роки тому +4

    Hey Mitch, this is your engagement ❤😁, btw Love you sir

  • @ahmadruswandi995
    @ahmadruswandi995 Рік тому +1

    Hi Mitch, enjoyed your excellent videos, thanks

  • @tommy9x
    @tommy9x 3 роки тому +1

    How to do what you r trying to do without touching XML? pure compose?

  • @mehdiparsaei1867
    @mehdiparsaei1867 3 роки тому +2

    I am improving my english language too with you. Thanks Thanks Thanks and more 1M times Like

  • @alexrusanovschi218
    @alexrusanovschi218 3 роки тому +3

    i see google ENGAGED pretty hard with the interoperability of their technologies, but i guess that your ENGAGEMENT to teach us the ways to do it is way harder!!!! thanks for your efforts and and for the knowledge you share with everyone!!!

  • @pundirAbhishek
    @pundirAbhishek 3 роки тому +1

    Hi, I want to ask can't we just set our custom view in the setContent in activity or do we need to add a ComposeView in the xml.

    • @bhuvneshvarma7843
      @bhuvneshvarma7843 3 роки тому

      Hi Mitch, my doubt is similar. While adding HorizontalDottedProgress custom view, you added ComposeView in XML and then inflated it.Can't you add ComposeView directly in fragment like you were doing previously??

  • @imashnake_7151
    @imashnake_7151 2 роки тому +1

    What a great overview of interoperability! It's 2022 now and I've seen answers on SO suggesting I get rid of fragments entirely (?!). Apparently, you can have bare composables in a Kotlin file. What's your take on this?

  • @mishaeliseev
    @mishaeliseev 3 роки тому +1

    If you have errors "override fun prepareCall(" Answer is here - stackoverflow.com/questions/65342763/unable-to-create-fragment-class-in-jetpack-compose

    • @samha1513
      @samha1513 3 роки тому +2

      thank you i was looking for this and was not able to find this issue.

  • @KshitijJain
    @KshitijJain 2 роки тому +2

    We can directly add customView even without adding any xml by doing this
    return ComposeView(requireContext()).apply {
    setContent {
    Column(verticalArrangement = Arrangement.Center) {
    CircularProgressIndicator(modifier = Modifier.align(Alignment.CenterHorizontally))
    Spacer(modifier = Modifier.padding(top = 16.dp))
    AndroidView(
    { context ->
    HorizontalDottedProgress(context)
    },
    modifier = Modifier.align(Alignment.CenterHorizontally)
    )
    }
    }
    }

  • @tommy9x
    @tommy9x 3 роки тому +1

    Plz make playlist for Jetpack compose

  • @garyjacobs330
    @garyjacobs330 3 роки тому +3

    Mitch - Absolutely the best Android tutorials on YT. Great production, very clear to understand. Thanks so much!

  • @edvardgrei6533
    @edvardgrei6533 3 роки тому +1

    Waiting for KMM) Great job

  • @saqibmuhammad7218
    @saqibmuhammad7218 3 роки тому +1

    Really Best videos

  • @prashantsurti5788
    @prashantsurti5788 3 роки тому +1

    Commenting for better reach

  • @myexperience_me_4646
    @myexperience_me_4646 3 роки тому +1

    Nice, it means kids can develop the application after born from 1 st day. Jet pack make life easy for devloper

  • @ayushsaini1175
    @ayushsaini1175 3 роки тому +1

    setContent{
    Column( modifier = Modifier.padding(16.dp) ){
    Text( "Hey Mitch, Thanks for the videos and I learned a lot from your channel. Thank you!")
    }
    }

  • @appsdeveloper4024
    @appsdeveloper4024 3 роки тому +1

    Hey Mitch

  • @gersongallo6892
    @gersongallo6892 3 роки тому +3

    Thanks for the compose videos, coming from the front end world switching to android always seemed like a daunting task, but with jetpack compose it seems like the concepts that I already know are more in sync with just as with flutter or react native

  • @roshanfx369
    @roshanfx369 3 роки тому +3

    Engagement!!

  • @ahmedshaaban9538
    @ahmedshaaban9538 3 роки тому

    thanks alot but why horizontal progress not work if i remove CircularProgressBar ??!!!

  • @robchr
    @robchr 3 роки тому +2

    something

  • @PrayagKeay
    @PrayagKeay 11 днів тому

    Thank you so much for your hard work! 😊 Just a small off-topic question: 😅 I have a set of words 🤷‍♂️. (behave today finger ski upon boy assault summer exhaust beauty stereo over). I’d be grateful for some help. 🙌

  • @MuhammadSalman-me5ks
    @MuhammadSalman-me5ks 3 роки тому +1

    enjoying the video

  • @ibrhm.117
    @ibrhm.117 3 роки тому +1

    Mitch you damn, just keep these coming, love your content, helped me a lot!

  • @ZahidAli-zg7ut
    @ZahidAli-zg7ut 3 роки тому +1

    thanks for compose video

  • @thomassantos7000
    @thomassantos7000 3 роки тому +1

    Hey Mitch! I'm waiting for next your videos about single activity

  • @SyyedChawan
    @SyyedChawan 18 днів тому

    Thanks for the forecast! I have a quick question: I have a SafePal wallet with USDT, and I have the seed phrase. (air carpet target dish off jeans toilet sweet piano spoil fruit essay). How can I transfer them to Binance?

  • @MohamedHelmyDeveloper
    @MohamedHelmyDeveloper 3 роки тому +1

    Wow, I am surprised by that much interoperability it's really great.
    Thanks Mitch

  • @mehdiparsaei1867
    @mehdiparsaei1867 3 роки тому

    Hello my best best best teacher. I am trying to create a fragment by extending Fragment. It forced me to implement prepareCall functions. I don't need to use Activity's function, how can I avoid of implementing for those? LIKE LIKE LIKE for changing my code style
    After deleting those implementing functions, app runs but there is a error in app:
    Class 'RecipeListFragment' is not abstract and does not implement abstract base class member public abstract fun prepareCall(contract: ActivityResultContract, callback: ActivityResultCallback): ActivityResultLauncher defined in androidx.fragment.app.Fragment

  • @alroygama6166
    @alroygama6166 3 роки тому +1

    Let's get engaged

  • @ShethMilan
    @ShethMilan Рік тому

    THanks for this video. Really appreciated. Keep up good work Mitch

  • @katherinesouza8812
    @katherinesouza8812 2 роки тому

    I looking for examples with jetpack compose call fragment in NavHostController is possible?

  • @thejohn1301
    @thejohn1301 3 роки тому +2

    I remember switching from relative layout to constraint layout,no here we go again... I don't know if I should be sad or happy.

    • @codingwithmitch
      @codingwithmitch  3 роки тому

      bitter sweet I guess

    • @dahlola
      @dahlola 3 роки тому

      I think constraintlayout is/will be present in compose also. Not sure how it's going to work though :)

    • @codingwithmitch
      @codingwithmitch  3 роки тому

      @@dahlola you can use constraint layout in compose. I'll show you that also

    • @dahlola
      @dahlola 3 роки тому +1

      @@codingwithmitch That would be awesome. I have linked your compose videos to my colleagues at work. Much appreciated.

  • @chillwithsyuqri7804
    @chillwithsyuqri7804 Рік тому

    hey mitch, thanks for the compose view, I got QUESTION!, how to navigate from composable file to activity file. fragment, i want to try implement esri map into my app. but esri not yet make the composable lib for their map. Please help! thank you so much mitch!

  • @SuperMarkwel
    @SuperMarkwel 3 роки тому +1

    cool, thx

  • @VenewebTV
    @VenewebTV 2 роки тому

    Hey Mitch, thanks for the video, regards from Caracas, Venezuela

  • @rex-xq8xg
    @rex-xq8xg 3 роки тому +2

    Engagement!!

  • @jasonhudgins8063
    @jasonhudgins8063 Рік тому

    Maybe you covered it elsewhere, but I was trying to figure out how to ditch the root activities XML completely (that's the whole point of Compose, right) instead using a bit of XML with a fragment container. The solutions I have found thus far are pretty horrific to implement.

  • @dmitrydemidov6112
    @dmitrydemidov6112 2 роки тому

    Hey Mitch! 1. Thx! 2. How can I update the value in compose fun? In your video and other tutorials you just hardcode it.

  • @mystride
    @mystride 2 роки тому

    Thoughts on Navigation-Compose vs. using Fragments?

  • @mrwhoknows
    @mrwhoknows 3 роки тому +1

    Android Studio Artic 🦊 engaged

  • @leonardosibela
    @leonardosibela 3 роки тому

    We should now use AmbientContext.current instead of ContextAmbient.current

  • @kisan_thapa
    @kisan_thapa 3 роки тому +1

    Excellent. I am in love with Jetpack Compose. ❤❤❤

  • @karan24189
    @karan24189 3 роки тому +1

    For How long you are working in android??

  • @Sherimankind
    @Sherimankind 3 роки тому

    Help me please anybody here.. I have been trying to migrate my project to Androidx but after the getting this error No usages found in the project

  • @yousefabdolzadeh1734
    @yousefabdolzadeh1734 2 роки тому

    Thanks you very much for jetpack composable series, mitch

  • @armandoavila4615
    @armandoavila4615 3 роки тому +1

    Great video! Thank you!

  • @FabielCasas
    @FabielCasas 3 роки тому

    good video about interoperability of compose thanks!!

  • @hirendesai8261
    @hirendesai8261 3 роки тому

    is there any bug in android studio canary 4.2? cause whenever i make changes in jetpack compose app i need to uninstall the app and then have to install it again in order to see changes. I'm not able to see changes after running app or instant run feature.

  • @tonnie7079
    @tonnie7079 2 роки тому

    Hi Mitch, like the video in 2021, here is your engagement!!

  •  Рік тому

    Ow, as a veteran of android 3 times, I am not so happy to see fragments are still usable with compose.

  • @nethubtv4079
    @nethubtv4079 Рік тому

    Hey, Mitch. Thank you for this course!

  • @buszi_
    @buszi_ 3 роки тому +1

    Hey Mitch, so I guess that at this moment we should still use single activity pattern with navigation component and fragments AND THEN use composables in fragments?
    I'm looking forward for your idea on how to attach it to backend or viewmodels, at this point the only way I've seen is to pass viewmodel to composables and observe data in corresponding child composables from fields in viewmodel

    • @codingwithmitch
      @codingwithmitch  3 роки тому

      Yep I'll be covering all that. And yes that's exactly right. I think the best way is single activity, one fragment per screen, one viewmodel per fragment, then composables

  • @gaurav3257
    @gaurav3257 3 роки тому

    How we can use jetpack compose with the dynamic fragments?

  • @ghZTrikz
    @ghZTrikz 2 роки тому

    Thank you! So good guide! Have a happy life;)

  • @kinenbrasil
    @kinenbrasil 3 роки тому

    Nice! Confused, but learned something new!

  • @localhost3662
    @localhost3662 3 роки тому +1

    Compose UI interoperability with the established view is good but in my opinion view(s) should be created with compose ui. I have been spectacle with interoperability approach. Instead of using fragment, it would be good to create entirely a compose-based screen. If we use compose ui entirely, then there is a steep learning curve as many views are not there yet.

    • @codingwithmitch
      @codingwithmitch  3 роки тому +2

      The fragment method I showed you here is the current best approach IMO. That way all the other components (viewmodel, mvvm/MVI, use cases, dependency Injection, Nav component) all still work great

    • @aminlotfolahi3470
      @aminlotfolahi3470 3 роки тому +1

      Good luck with entirely a compose-based screen!!

    • @aakarshrestha7525
      @aakarshrestha7525 3 роки тому +1

      @@codingwithmitch Great effort like always... kudos to you!

  • @nikhilsalunke7019
    @nikhilsalunke7019 2 роки тому

    Great video, Mitch! Here's your engagement.

  • @thearpansircar
    @thearpansircar 3 роки тому

    Great video, Mitch! Here's your engagement.

  • @BearkFearGamer
    @BearkFearGamer 3 роки тому

    What font are you using, and i know it's not the 'consolas'

  • @mustafam484
    @mustafam484 7 місяців тому

    Can I use Jetpack Compose without using Layout ?

  • @palaksdarji
    @palaksdarji 2 роки тому

    Thanks Mitch, it really helped. Saved a lot of time.

  • @hsuwei-yen472
    @hsuwei-yen472 11 місяців тому

    Google always sucks in Guide Doc. Thx.

  • @shalinikhosla971
    @shalinikhosla971 3 роки тому

    Hey mitch, thanks for the videos..its amazing

  • @paulvickers8059
    @paulvickers8059 3 роки тому +2

    keep the jetpack compose stuff coming. would be good to see a compose app with a room database. Is this possible with Compose yet?

    • @codingwithmitch
      @codingwithmitch  3 роки тому +1

      Yep I'm making the course right now
      codingwithmitch.com/courses/food2fork-recipe-app/

  • @gamiike
    @gamiike 3 роки тому

    Nice Compose! Nice T-Shirt with Japanese!

  • @ChrisAthanas
    @ChrisAthanas 3 роки тому +1

    Engage da warp engines

  • @matt_graham
    @matt_graham 3 роки тому +1

    Thanks for sharing!!!

  • @محسننادرزاده
    @محسننادرزاده 2 роки тому

    Hey Mitch thanks for your compose videos

  • @argahutama
    @argahutama 3 роки тому +1

    Hello Mitch, have a nice day 😁

  • @bryankiani8902
    @bryankiani8902 Рік тому

    Nicee! just what I needed! Thank you Mitch

  • @johnybaby9574
    @johnybaby9574 3 роки тому

    ContextAmbient.current --> AmbientContext.current

  • @AlgeriaHere
    @AlgeriaHere 3 роки тому

    Thank you for the great video but i have question if possible , now for the HoizontalProgressbar , we passed it to the android view , what if we have mulple custom view , should we duplicate the code or not , i mean this way
    val customView1 = HorizontalDottedProgress(ContextAmbient.current)
    AndroidView(viewBlock = { customView1 })
    val customView2 = HorizontalDottedProgress(ContextAmbient.current)
    AndroidView(viewBlock = { customView2 })

    • @codingwithmitch
      @codingwithmitch  3 роки тому +1

      yeah what's wrong with that

    • @AlgeriaHere
      @AlgeriaHere 3 роки тому

      @@codingwithmitch i mean i just asked if that's a good approach to do that , thank you for the video

  • @mrdeveloper4438
    @mrdeveloper4438 3 роки тому +1

    (like)

  • @godwinntowdanso4111
    @godwinntowdanso4111 Рік тому

    Thanks for the video. very helpful

  • @prashantchopde2622
    @prashantchopde2622 2 роки тому

    Great video on compose interoperability..

  • @Jakob_D
    @Jakob_D 3 роки тому +1

    Hey Mitch, this is your engagement!
    btw no shave november is over ;)

    • @codingwithmitch
      @codingwithmitch  3 роки тому

      😂 I'm keeping the facial hair alive for a little longer

  • @HelloBayzid
    @HelloBayzid 3 роки тому +1

    Thanks for give this course free.

  • @Zaichan69
    @Zaichan69 Рік тому

    ContextAmbient.current was changed for LocalContext.current in new versions also AndroidView(viewBlock = {customView}) now is AndroidView(factory = {customView})
    still this tutorial is awesome thanks

  • @benbastami2515
    @benbastami2515 2 роки тому

    nicely done, keep up the good work! thanks

  • @dipakgiri2088
    @dipakgiri2088 3 роки тому +1

    Thank you for compose video, can you make a video on compose animations? 🥺

  • @АлександрПальчевский-г7о

    Hey Mitch thank you for this tutorial. Hello from Ukraine 👋

  • @TEGRCOLLC
    @TEGRCOLLC 3 місяці тому

    Here is your engagement. I loved it.

  • @alvaroisea2259
    @alvaroisea2259 2 роки тому

    big fan of your videos man, thanks a lot!

  • @stacklearn
    @stacklearn 2 роки тому

    Hey mitch. Im saying something

  • @vladimirpavlov
    @vladimirpavlov 3 роки тому

    Thank you very much Mitch, keep it up!

  • @samha1513
    @samha1513 3 роки тому

    @2:20 when I extend the fragment I get an odd error says *Class RecipeListFragment is not abstract and does not implement abstract base class member.....* does anyone know what causes this? Thanks

    • @codingwithmitch
      @codingwithmitch  3 роки тому

      Ya I get that too. Looks like some new members being added to the fragment class. I didn't look much into it since the app still built and ran regardless of me doing anything about the members.

  • @dbtechprojects2392
    @dbtechprojects2392 3 роки тому

    Building with this is a breeze

  • @haythama8563
    @haythama8563 3 роки тому +1

    Thank you very much, as always very useful info ♥

  • @sheenfabile9460
    @sheenfabile9460 3 роки тому +1

    Looks great Mitch. Keep it up man!

  • @ravidadhania6722
    @ravidadhania6722 3 роки тому

    Hey Brother, this is your engagement.

  • @nilanjanmukhopadhyay8369
    @nilanjanmukhopadhyay8369 3 роки тому

    Hey Mitch, here is your engagement.

  • @alex_riakhin
    @alex_riakhin Рік тому

    hey! I’m an iOS dev and I just recently discovered how neat Kotlin and Jetpack Compose actually are! Thanks for the course!

  • @AmmarFaris
    @AmmarFaris 3 роки тому

    For those experiencing crashing of app when using latest tools and dependencies, you may want to add this (compose-theme-adapter) in dependencies:
    implementation "com.google.android.material:compose-theme-adapter:$compose_version"

  • @pavelh756
    @pavelh756 3 роки тому

    When starting new project with Compose, is there any need to use Fragments? Seems to me like Google is trying to lean away from Fragments with Compose (very flutter-like, everything is screen/widget/ui). Even navigation with compose leaves Fragments out of the loop developer.android.com/jetpack/compose/navigation