Literally a life saver 4 years later. Clearest way to do this. Cheers!
@yurco4 жыл бұрын
Thank you. In almost every website people say that is impossible. And you make it seems so easy.
@joaovitorsilveirabranco88554 жыл бұрын
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.
@rodneyperello2 жыл бұрын
Finally! Something simple, correct, and succinct! Thank you Sir.
@FarooqAhmad-lr1fx2 жыл бұрын
Useful. In fact, all your toturial came useful to me. thanks
@user735_4 жыл бұрын
Thanks, my crashing app was fixed thanks to this.
@saqibmasood67784 жыл бұрын
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.
@vikasverma34534 жыл бұрын
Thanks a lot Mitch... it is very helpful to understand the subject concept.
@javaddehghan87374 жыл бұрын
many thanks. that was very very good.i search a lot and i was hopeless from answer
@akshunkc68845 жыл бұрын
great video saved me from great deal of trouble ... thank u very much
@vedantbarsainya83313 жыл бұрын
Love your work man!!! Helped me when I had just about given uppp!!
@iamkrishn3 жыл бұрын
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...)
@roxinol46905 жыл бұрын
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?
@kanskejonasidag16 жыл бұрын
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.
@muhammadzawawi13886 жыл бұрын
I love the way you share the source code! u got a sub from me.
@vapecat3 жыл бұрын
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!
@DiamondTMZ3 жыл бұрын
thanks!
@macchiato_18812 жыл бұрын
oh my god you just saved me a few days worth of scouring through stackoverflow thank you so much dude
@andreyvolodko12302 жыл бұрын
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 Жыл бұрын
@@andreyvolodko1230 thanks will try later
@asishsiwakoti55644 жыл бұрын
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....
@rsklkldn4305 жыл бұрын
Thank you. I think you're good at teaching)
@fadhlifirdaussulaiman14635 жыл бұрын
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
@zipfreesty6 жыл бұрын
Great tutorial ! thanx a lot ! very useful for my personal project !
@ibrahimhossam79852 жыл бұрын
Thank you so much bro ... you are great
@HariKrishnan-es6po3 жыл бұрын
Well explained 👍👍
@mariamihaela94 жыл бұрын
You are literally a life saver :)) ! Thanks
@fk151568535 жыл бұрын
man i almost tried eveythin to get it to work , so it was a simple setTarget before lunch :3
@SinisterEclipse1414 жыл бұрын
I had the same problem!
@JazibOfficial6 жыл бұрын
Awesome video! BUT... Material Dialog Library is the easiest way XD jk
@roshansebastian18626 жыл бұрын
did u mean Dialog Fragment ?
@ruif3r3 жыл бұрын
maybe an updated video of this would be nice, cheers
@dreamsmartitservices2375 жыл бұрын
très efficace comme tuto je suis très satisfaite
@sahilsonkar99794 жыл бұрын
It's a great help sir
@fergferg443 жыл бұрын
thanks this helped so much
@ibrahimqassem22545 жыл бұрын
Thank you So match for This Tutorial Sir
@bernaem77036 жыл бұрын
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.
@Lawnio5 жыл бұрын
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
@cheokeejin8564 жыл бұрын
@@Lawnio Ive got the same issue. Have you resolved your problem?
@Lawnio4 жыл бұрын
@@cheokeejin856 i don't remember watching this. But for dialogs, you should check those from Material design. They are really easy to use
@zecaszecar4 жыл бұрын
Super like for the Super man!!
@havefun36154 жыл бұрын
thanks a lot , you saved my day
@user-ph2ne4eh1q4 жыл бұрын
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.
@aiyuayaan4 жыл бұрын
Thank you Soo much Sir 🥰🥰🥰🥰
@hectorcorniel34226 жыл бұрын
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
@digitalandroid81696 жыл бұрын
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.
@codingwithmitch6 жыл бұрын
Digital Android that's what I did. Did you watch the whole video?
@digitalandroid81696 жыл бұрын
Sorry! Did not watch the second half when I saw how you were just using setText at the start. My bad man
@codingwithmitch6 жыл бұрын
No worries. Honestly happens all the time. It's because I show the "non-best-practice" way usually first. Then the best practice way.
@annam21956 жыл бұрын
do you know a good book for android wear? or are you going to make a tutorial for it?
@songqiaocui29505 жыл бұрын
Hi, your video is great but I get trouble to let it show. Can you figure it out?
@papatampan3 жыл бұрын
how to set data in a Dialog EditText ? i mean, i want to load data from shared preference into EditText in a Dialog box.
@Lawnio5 жыл бұрын
I get a " declared fragment fragmentName that does not belong to this fragmentManager" Any ideas?
@abdullahbaabbad8854 жыл бұрын
Can anyone explain why using interface is better practice than the straight forward logic?
@noitrealian99603 жыл бұрын
Can't call getFragmentManager in Fragment, but it works in Activity. what's the solution?
@francofazzolari79735 жыл бұрын
How did you comment all those lines at the same time? Nice trick 11:41
@TheEyupalkis5 жыл бұрын
@Akbar Umar and also ctrl+shift+/
@kunaldhuria39355 жыл бұрын
God bless you man, but the issue i am facing is that this code crashes on screen rotation, please help.
@duncantsen35686 жыл бұрын
How on earth is your gradle build and apk install so quick? Any guides or tips?
@codingwithmitch6 жыл бұрын
Duncan Tsen I clip the video 😉
@samthexplorer96216 жыл бұрын
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?
@neski3113 жыл бұрын
In minute 8:13, how do I put two EditText?
@svenv325 жыл бұрын
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?
@samirshrestha52525 жыл бұрын
Sir, make video on how to use dropdown menu in fragment and get selected item value
@qusaiatoon28024 жыл бұрын
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 ??
@MagicMindsAnimations2 жыл бұрын
single Choise item how to recieve on thier dialog launching fragment i.e host fragment of dialog or which the dialog lauch
@samo92mx6 жыл бұрын
how you record your videos???
@abhishek_bhardwaj6 жыл бұрын
Thanks Man!.. You made my day!!
@automationworld33575 жыл бұрын
excellent...
@FISH-ox1iz5 жыл бұрын
thx u it's helpful
@vleesevlons6 жыл бұрын
Does anyone know how to use a Dialog over multiple fragments?
@codingwithmitch6 жыл бұрын
You mean a bunch of fragments overlayed on top of each other? Just inflate the dialog from the activity hosting them all.
@vishnu_j4 жыл бұрын
@@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_j4 жыл бұрын
@@codingwithmitch excuse me sir
@badrlakrimi98375 жыл бұрын
that was so helpfull ty man :)
@vit6723 Жыл бұрын
some are depcreated but still working nice
@arthurbarbosaqueirozbisnet1045 жыл бұрын
Thank you!
@reaganr15165 жыл бұрын
What is that emulator?
@codingwithmitch5 жыл бұрын
It's a real device being mirrored. You can do that with a program called vysor
@ogustavozera6 жыл бұрын
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
@asifiqbal12616 жыл бұрын
Please make an eCommerce app. using php back end, Thank you.
@louisth52554 жыл бұрын
Thanks
@cruisemaster62755 жыл бұрын
This is a great tutorial. But why are you sooo fast mehn, you are carrying people along.