Learn how to implement fragment using framelayout.
For additional help/customization and tasks reach me via.
https://www.fiverr.com/share/ADdzzR
In this video tutorial, we shall learn how to implement fragment using framelayout.
A fragment represent a reusable portion of your app's UI.
so today we are going to learn how to implement frame layout in android as you can see from this application i have to fragment a fragment 1 and fragment 2.
when i click the first button it's displaying this is fragment one.
when i click the second button it's displaying circled fragment from my layout.
you can see i have first and half second one so the second fragment has a title that is a code fragment but the first one doesn't have which means it's getting the data to display from the main activity that hosts it so in this tutorial we are going to learn how to host different active different fragment in the same activity and we are also going to learn how to pass data from the activity to a fragment in our part two of the tutorial we are going to learn how to pass data back from that fragment to main activity so guys stay tuned so just a walk through on what is happening we have fragment one and we have fragment two above main activity which is hosting our fragments so within the main activity i have this switch fragment method which is 12 o'clock which is getting data that is the parameter whether uh to display the first or the second fragment if it's first it's going to get the first fragment if it's second it's going to get the second fragment here you can see arguments which are used to pass data from the main activity or the host activity to a fragment here we have the key and the value the key should be the same so as you can see in my first fragment i have the key as parallel one that's what i'm using from the main activity to pass data to my fragment then i'm going to set the fragment arguments to my ads then have a value that is fragment transition which is support fragment manager dot begin transition transition dot press we are going to repress our frame layout and then we are going to add another parameter that is our selected fragment add backtrace and then we are going to commit so let's get started with this i'm going to create a new project i'm going to select empty i'm going to call it flagment
Thanks for watching .
Subscribe for more tutorials https://www.youtube.com/c/larntech20?...
For any clarification or question feel free to comment below.
Смотрите видео Android Studio Fragments Using FrameLayout - Fragments Fundamentals онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь larn tech 05 Июнь 2021, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 4,156 раз и оно понравилось 26 людям.