Dialog Fragment to Fragment

  Рет қаралды 49,594

CodingWithMitch

CodingWithMitch

Күн бұрын

Пікірлер: 83
@zrvnavi23
@zrvnavi23 Жыл бұрын
Literally a life saver 4 years later. Clearest way to do this. Cheers!
@yurco
@yurco 4 жыл бұрын
Thank you. In almost every website people say that is impossible. And you make it seems so easy.
@joaovitorsilveirabranco8855
@joaovitorsilveirabranco8855 4 жыл бұрын
Thank you very much, I'm developing my app and I didn't know how I used dialogs within fragments, but you gave me a great help. I am Brazilian and here it is difficult to find good videos on android.
@rodneyperello
@rodneyperello 2 жыл бұрын
Finally! Something simple, correct, and succinct! Thank you Sir.
@FarooqAhmad-lr1fx
@FarooqAhmad-lr1fx 2 жыл бұрын
Useful. In fact, all your toturial came useful to me. thanks
@user735_
@user735_ 4 жыл бұрын
Thanks, my crashing app was fixed thanks to this.
@saqibmasood6778
@saqibmasood6778 4 жыл бұрын
Hi Mitch. I was following this tutorial and i ended up having a recyclerview in the dialog fragment. I was able to do a toast on the recyclerview item click. But i am not able to close the dialog fragment along with that toast. I mean i click an option in the recyclerview through its adapter but i am not able close this dialog fragment along with this click, probably as i dont have a reference to the dialog fragment in the adapter of the recycler view. Can you please help me. I am still a beginner so please explain in terms of exact code to write. Thanks already for the beautiful and followable tutorials.
@vikasverma3453
@vikasverma3453 4 жыл бұрын
Thanks a lot Mitch... it is very helpful to understand the subject concept.
@javaddehghan8737
@javaddehghan8737 4 жыл бұрын
many thanks. that was very very good.i search a lot and i was hopeless from answer
@akshunkc6884
@akshunkc6884 5 жыл бұрын
great video saved me from great deal of trouble ... thank u very much
@vedantbarsainya8331
@vedantbarsainya8331 3 жыл бұрын
Love your work man!!! Helped me when I had just about given uppp!!
@iamkrishn
@iamkrishn 3 жыл бұрын
What if I want to send some value to the dialog from the MainFragment as well? Do I need to create an interface in the MainFragment and then let the DialogFragment implement it? Or is there a workaround of some kind? I don't want the Activity to be involved in this. (Although I know that's the best practice, event bus and all...)
@roxinol4690
@roxinol4690 5 жыл бұрын
Hi, when I click the button I have this error. java.lang.NullPointerException: Attempt to invoke virtual method 'void com.ola.ricardo.ola2.MainFragment.sendInput(java.lang.String)' on a null object reference How can I resolve this?
@kanskejonasidag1
@kanskejonasidag1 6 жыл бұрын
The reason why it wouldn't work with v4 fragment might be that for it to work you need to use getSupportFragmentManager() I think. And also, extend FragmentActivity.
@muhammadzawawi1388
@muhammadzawawi1388 6 жыл бұрын
I love the way you share the source code! u got a sub from me.
@vapecat
@vapecat 3 жыл бұрын
getTargetFragment() is deprecated, how to replace this? edit I found the way (i only know how to use it in kotlin so maybe you can copy paste it and let android studio convert it to java) : in MainFragment //inside your open dialog clickListener var dialog = MyCustomDialog() dialog.show(parentFragmentManager, "MyCustomDialog") dialog.setFragmentResultListener("1"){ key, bundle -> if (key == "1"){ mInputDisplay.text = bundle.getString("1") } } in MyCustomDialog //inside m.ActionOk button val input: String = mInput.getText().toString() val bundle = Bundle() bundle.putString("1", input) setFragmentResult("1", bundle) dismiss() so no need to use onAttach and implement the interface, hope this helps!
@DiamondTMZ
@DiamondTMZ 3 жыл бұрын
thanks!
@macchiato_1881
@macchiato_1881 2 жыл бұрын
oh my god you just saved me a few days worth of scouring through stackoverflow thank you so much dude
@andreyvolodko1230
@andreyvolodko1230 2 жыл бұрын
Yes, its works, but i think i got better idea. In onAttach method insted mOnInputSelected = (onInputSelected) getTargetFragment(); use mOnInputSelected = (mOnInputSelected) getParentFragmentManager().findFragmentByTag("TAG");//IMPORTANT! TAG is that you use when you cal your fragment in FragmentTransaction.replace () and when you create a dialog, insted dialog.setTargetFragment(MainFragment.this, 1); use getParentFragmentManager().setFragmentResultListener(1, MainFragment.this, new FragmentResultListener() { @Override public void onFragmentResult(@NonNull String requestKey, @NonNull Bundle result) { } }); dialog.show(getParentFragmentManager(),"MyCustomDialog") And it works exacly like when you use dialogs in Activity
@sumrjd
@sumrjd Жыл бұрын
@@andreyvolodko1230 thanks will try later
@asishsiwakoti5564
@asishsiwakoti5564 4 жыл бұрын
thanks man i wonder for this very long time but i cant got any were but u just do this man thanks thanks and again thanks....
@rsklkldn430
@rsklkldn430 5 жыл бұрын
Thank you. I think you're good at teaching)
@fadhlifirdaussulaiman1463
@fadhlifirdaussulaiman1463 5 жыл бұрын
Thank god I found this video T_T.. Thanks bro, it helped, gonna sub and like this video. Many thanks again, you don't know how you had helped a needy guy
@zipfreesty
@zipfreesty 6 жыл бұрын
Great tutorial ! thanx a lot ! very useful for my personal project !
@ibrahimhossam7985
@ibrahimhossam7985 2 жыл бұрын
Thank you so much bro ... you are great
@HariKrishnan-es6po
@HariKrishnan-es6po 3 жыл бұрын
Well explained 👍👍
@mariamihaela9
@mariamihaela9 4 жыл бұрын
You are literally a life saver :)) ! Thanks
@fk15156853
@fk15156853 5 жыл бұрын
man i almost tried eveythin to get it to work , so it was a simple setTarget before lunch :3
@SinisterEclipse141
@SinisterEclipse141 4 жыл бұрын
I had the same problem!
@JazibOfficial
@JazibOfficial 6 жыл бұрын
Awesome video! BUT... Material Dialog Library is the easiest way XD jk
@roshansebastian1862
@roshansebastian1862 6 жыл бұрын
did u mean Dialog Fragment ?
@ruif3r
@ruif3r 3 жыл бұрын
maybe an updated video of this would be nice, cheers
@dreamsmartitservices237
@dreamsmartitservices237 5 жыл бұрын
très efficace comme tuto je suis très satisfaite
@sahilsonkar9979
@sahilsonkar9979 4 жыл бұрын
It's a great help sir
@fergferg44
@fergferg44 3 жыл бұрын
thanks this helped so much
@ibrahimqassem2254
@ibrahimqassem2254 5 жыл бұрын
Thank you So match for This Tutorial Sir
@bernaem7703
@bernaem7703 6 жыл бұрын
Hello my friend, great video, but the dialogfragment are callback from the activitymain but not from de an fragment, have you and example or any link where show it ? Call back an dialog fragmet from the fragment (not activity main). Thank in advance. Regards.
@Lawnio
@Lawnio 5 жыл бұрын
Hey Berna, Could you elaborate? I might have an issue related to what your saying. I get a " declared fragment fragmentName that does not belong to this fragmentManager" something to do with the setTargetFragment
@cheokeejin856
@cheokeejin856 4 жыл бұрын
@@Lawnio Ive got the same issue. Have you resolved your problem?
@Lawnio
@Lawnio 4 жыл бұрын
@@cheokeejin856 i don't remember watching this. But for dialogs, you should check those from Material design. They are really easy to use
@zecaszecar
@zecaszecar 4 жыл бұрын
Super like for the Super man!!
@havefun3615
@havefun3615 4 жыл бұрын
thanks a lot , you saved my day
@user-ph2ne4eh1q
@user-ph2ne4eh1q 4 жыл бұрын
How do i make it so every time i enter data in the dialog it creates a new text view and don't overwrite the old one.
@aiyuayaan
@aiyuayaan 4 жыл бұрын
Thank you Soo much Sir 🥰🥰🥰🥰
@hectorcorniel3422
@hectorcorniel3422 6 жыл бұрын
Hello sir , can you make a tutorial about saving spinner values, I'm working in a app I have an spinner but when I SignOut the values disappear
@digitalandroid8169
@digitalandroid8169 6 жыл бұрын
Okay video, but it is best to try and keep software as loosely couple as possible - this video promotes a direct relationship between the dialog and the fragment for changing the textview. It would be better to use an interface as a callback to change the textViews. The fragment implements the interface, the fragment passes a reference of itself through an init() method when creating the interface.
@codingwithmitch
@codingwithmitch 6 жыл бұрын
Digital Android that's what I did. Did you watch the whole video?
@digitalandroid8169
@digitalandroid8169 6 жыл бұрын
Sorry! Did not watch the second half when I saw how you were just using setText at the start. My bad man
@codingwithmitch
@codingwithmitch 6 жыл бұрын
No worries. Honestly happens all the time. It's because I show the "non-best-practice" way usually first. Then the best practice way.
@annam2195
@annam2195 6 жыл бұрын
do you know a good book for android wear? or are you going to make a tutorial for it?
@songqiaocui2950
@songqiaocui2950 5 жыл бұрын
Hi, your video is great but I get trouble to let it show. Can you figure it out?
@papatampan
@papatampan 3 жыл бұрын
how to set data in a Dialog EditText ? i mean, i want to load data from shared preference into EditText in a Dialog box.
@Lawnio
@Lawnio 5 жыл бұрын
I get a " declared fragment fragmentName that does not belong to this fragmentManager" Any ideas?
@abdullahbaabbad885
@abdullahbaabbad885 4 жыл бұрын
Can anyone explain why using interface is better practice than the straight forward logic?
@noitrealian9960
@noitrealian9960 3 жыл бұрын
Can't call getFragmentManager in Fragment, but it works in Activity. what's the solution?
@francofazzolari7973
@francofazzolari7973 5 жыл бұрын
How did you comment all those lines at the same time? Nice trick 11:41
@TheEyupalkis
@TheEyupalkis 5 жыл бұрын
@Akbar Umar and also ctrl+shift+/
@kunaldhuria3935
@kunaldhuria3935 5 жыл бұрын
God bless you man, but the issue i am facing is that this code crashes on screen rotation, please help.
@duncantsen3568
@duncantsen3568 6 жыл бұрын
How on earth is your gradle build and apk install so quick? Any guides or tips?
@codingwithmitch
@codingwithmitch 6 жыл бұрын
Duncan Tsen I clip the video 😉
@samthexplorer9621
@samthexplorer9621 6 жыл бұрын
Hey Mitch, I'm an iOS dev trying to master Android. I have a little problem I'd like you to assist me with. I want to calc the size(width and height) of a String. Folks on Stackoverflow say i should use Paint() but it couldn't give me accurate results. Do you have a more accurate way i can calculate the size of a String?
@neski311
@neski311 3 жыл бұрын
In minute 8:13, how do I put two EditText?
@svenv32
@svenv32 5 жыл бұрын
can we make this pop up contain user's post and people able to comment on it ? then users dismiss it when ever he wants to?
@samirshrestha5252
@samirshrestha5252 5 жыл бұрын
Sir, make video on how to use dropdown menu in fragment and get selected item value
@qusaiatoon2802
@qusaiatoon2802 4 жыл бұрын
every thing was working good when i used dialogs in Activities .....but now with Framents the getFragmentManager() method is not working .....can anybody help me to find a solution ??
@MagicMindsAnimations
@MagicMindsAnimations 2 жыл бұрын
single Choise item how to recieve on thier dialog launching fragment i.e host fragment of dialog or which the dialog lauch
@samo92mx
@samo92mx 6 жыл бұрын
how you record your videos???
@abhishek_bhardwaj
@abhishek_bhardwaj 6 жыл бұрын
Thanks Man!.. You made my day!!
@automationworld3357
@automationworld3357 5 жыл бұрын
excellent...
@FISH-ox1iz
@FISH-ox1iz 5 жыл бұрын
thx u it's helpful
@vleesevlons
@vleesevlons 6 жыл бұрын
Does anyone know how to use a Dialog over multiple fragments?
@codingwithmitch
@codingwithmitch 6 жыл бұрын
You mean a bunch of fragments overlayed on top of each other? Just inflate the dialog from the activity hosting them all.
@vishnu_j
@vishnu_j 4 жыл бұрын
@@codingwithmitch sir thank you so much ,but how to do with save preference were should we give that in dialogue,or in main frag please reply me 😭
@vishnu_j
@vishnu_j 4 жыл бұрын
@@codingwithmitch excuse me sir
@badrlakrimi9837
@badrlakrimi9837 5 жыл бұрын
that was so helpfull ty man :)
@vit6723
@vit6723 Жыл бұрын
some are depcreated but still working nice
@arthurbarbosaqueirozbisnet104
@arthurbarbosaqueirozbisnet104 5 жыл бұрын
Thank you!
@reaganr1516
@reaganr1516 5 жыл бұрын
What is that emulator?
@codingwithmitch
@codingwithmitch 5 жыл бұрын
It's a real device being mirrored. You can do that with a program called vysor
@ogustavozera
@ogustavozera 6 жыл бұрын
I'm thinking of using this method to be able to change the link of a videoview.. But I do not know how to use this method to change a configuration of the class example: the person clicks the button to open the AlertDialog and has the edittext asking for the stream link of the video that will be played in Videoview, the person puts the link and automatically "Change" The link in MainActivity. Class (click in show more) I made a post on Stackoverflow.. Please help me! stackoverflow.com/questions/49435976/change-link-of-videoview
@asifiqbal1261
@asifiqbal1261 6 жыл бұрын
Please make an eCommerce app. using php back end, Thank you.
@louisth5255
@louisth5255 4 жыл бұрын
Thanks
@cruisemaster6275
@cruisemaster6275 5 жыл бұрын
This is a great tutorial. But why are you sooo fast mehn, you are carrying people along.
Android Dialog Fragment to Activity
12:17
CodingWithMitch
Рет қаралды 57 М.
Fragment to Fragment Communication
42:14
CodingWithMitch
Рет қаралды 33 М.
😜 #aminkavitaminka #aminokka #аминкавитаминка
00:14
Аминка Витаминка
Рет қаралды 2,5 МЛН
НИКИТА ПОДСТАВИЛ ДЖОНИ 😡
01:00
HOOOTDOGS
Рет қаралды 3,2 МЛН
HELP!!!
00:46
Natan por Aí
Рет қаралды 32 МЛН
RecyclerView OnClickListener (Best practice way)
11:48
CodingWithMitch
Рет қаралды 292 М.
Android Studio/Урок 9N/AlertDialog
23:59
Neco Ru
Рет қаралды 6 М.
What are Kotlin Interfaces Used For and Why?
8:36
Donn Felker
Рет қаралды 5 М.
Fragment to Fragment Communication in Android Studio [Kotlin 2020]
11:39
Gradle tutorial for complete beginners
24:48
Tom Gregory Tech
Рет қаралды 227 М.
Fragments in SAPUI5 / Fiori | SAP Fiori Tutorial
12:07
SAP Agile Learners
Рет қаралды 2,4 М.
Navigation: Dialog destinations - MAD Skills
8:46
Android Developers
Рет қаралды 29 М.
DO NOT do this in a Software Engineering Interview
7:59
CodingWithMitch
Рет қаралды 9 М.
Git Submodules Tutorial | For Beginners
14:52
Redhwan Nacef
Рет қаралды 156 М.
😜 #aminkavitaminka #aminokka #аминкавитаминка
00:14
Аминка Витаминка
Рет қаралды 2,5 МЛН