How to Send Data from a Fragment to Another in Android - Navigation Drawer

preview_player
Показать описание
You will learn how to send data from one Fragment to Another Fragment in Android. This tutorial is for beginners. Usually you use Intent to send data from one Activity to another Activity but here it is a little different, from a Fragment to another one. Actually, what you need is just a method setArguements() with a Bundle parameter. You create an instance from Bundle and you send data through it. And in a received Fragment, you can get the data from getArguments() method with the return type of Bundle. It is fairly easy. If you know in detail, please watch the video tutorial.

If you want to see cool videos like this about Android Studio, please follow me at:
For English version:

To get all the latest update video tutorials, I encourage to subscribe to this channel, and don't forget to share this video to your friends on your social networks. If you have any question, please comment below and I will try to answer as many as I can.

Thank you very much,

Oum Saokosal

Рекомендации по теме
Комментарии
Автор

THANK YOU VERY MUCH, 3:30 FINALLY AFTER 3 DAYS I FIND THIS AND WORK

vn
Автор

Thanks its very helpful, I can now pass data to fragment with SQLite, already subbed

darwinpose
Автор

rather than opening gallery fragment, can i open pdf view file with button that you created?

dev.faizan
Автор

Can you help me send data from a customAdapter to a SubFragment? I have a customadapter with a customlistview. When i click on the listview (listview is inside another fragment) then it has to take the bundle and put inside the SubFragment.

allesominta
Автор

isn't it the same as passing data from one activity to another (explicit intent)?
Thanks.

QasimWani
Автор

Thank you for your video. I have a question. i have login activity, main activity, Test activity. I want the user ID from Login activity to use in Test activity in the purpose as parameter then what should i do? thank you in advance

sempanhavuth
Автор

Thank you for help. Can you tell how i can change title name in thing type of Activity?, Once Again Thank you

akee
Автор

when using interface i get a nullpointexception but this one works fine is it preferred over using interface

porialoy
Автор

which macbook you are using? send me complete details of your macbook :P

aimankashif
Автор

Hi, I enjoyed your video. Can you tell me how I can send an integer instead of string and in fragment two show it in TextView ?
And how can I save the data permenantly, like even if I leave the app, my datas are still there...
I hope you can help me out with this!

ghadirsaadati
Автор

Sir, what if I want to get id from MainActivity, and use it in Fragment2. Or get id from Fragment2 and use it in MainActivity ?

justbear
Автор

Very hard to use constraintsLayout when views are very closed to each other . so how to use constraints layout in this (I not big fan of constraints layout but may be in future I will use . I am beginner of android app development. )

rKringtonezone
Автор

sir help me for fragment data storage in SQLite database

kittul
Автор

there is a warning in my studio . 1st warning is this variable is never used.
and the 2nd one is casting to Button is redundant. i wanna tell you one more thing i updated android studio some days ago.
please help me ! what should i do ?

muhammadusman
Автор

Please make a tutorial on how to fix R (red color error). What causes it n possible fix. i tried everything, but nothng worked. :(

Heafyshiu
Автор

how can i send data from the activity to a fragment??

francofelippelli_coach
Автор

when i did what you did i got the bundle in the second Fragment with null value !! ??

alaamuhamed