Open NeoLSN opened 8 years ago
They are DialogFragments
, which is a class that extends Fragment
So technically they should be usable in an Activity
.
That being said, I never tested this. Let me know how it goes :-)
If you use a DialogFragment
in activity layout, it will jump out a dialog after activity created.
What I want is to use a View class in the layout.
In that case it's not supported right now. I don't have a lot of time to work on this at the moment, and still a lot of things that are higher up on the priority list. You'll find most of the components you want in separate classes. If you can manage to integrate it in a transparent matter to the current functionality, I'm more than happy to take a pull request :-)
I have successfully embedded the TimePickerDialog into Activity, just like it says in DialogFragment documentation.
In the Activity's layout there is a view with id embedded
. Only the OnTimeSetListener
is useless, you have to check the time manually with getSelectedTime()
Is this not the behaviour you wanted?
FragmentTransaction ft = getFragmentManager().beginTransaction();
DialogFragment newFragment = TimePickerDialog.newInstance(null, 0, 0, 0, true);
ft.add(R.id.embedded, newFragment);
ft.commit();
Can they be independent view classes like DatePicker or TimePicker so they can be apply in activity or fragment not only in a dialog?