android-dialogfragment

Hide buttons in DialogFragment in Android

。_饼干妹妹 提交于 2019-12-12 00:30:14
问题 I have Dialog Fragment implemented like this public class SessionExpiredFragment extends DialogFragment { public interface SessionExpiredFragmentListener { public void onCancelLoginProcessPressed(DialogFragment dialog); // validValues = true if fields are not empty and email is a valid // email, // else validValues = false; public void onOKLoginProcessPressed(DialogFragment dialog, boolean validValues); } SessionExpiredFragmentListener mListener; @Override public void onAttach(Activity

ViewPager on DialogFragment - java.lang.IllegalStateException: No activity

守給你的承諾、 提交于 2019-12-11 23:27:48
问题 I am implementing a photo-zooming view appears on top of the thumbnail grid by using DialogFragment. It contains a ViewPager allowing user switch photos. Here is detail of DialogFragment: public class DialogContainer extends PhotoViewerDialogFragment{ public DialogContainer () { super(); } @Override public Dialog onCreateDialog(Bundle savedInstanceState) { Dialog dialog = super.onCreateDialog(savedInstanceState); // request a window without the title dialog.setContentView(R.layout.fragment

DialogFragment issues with screen orientation and MediaController

蓝咒 提交于 2019-12-11 19:19:24
问题 I have an app which plays videos in a DialogFragment . I have added MediaController to the VideoView however there are two issues: MediaController is hidden behind the DialogFragment . Change in screen orientation when the DialogFragment is visible results in an exception that the activity has a leaked window For the first one, I tried using linearLayoutParent.bringChildToFront(mediaControls) which did not work. And I do not know how to deal with the second one. Help me out. :) 回答1: Although

showing a DatePickerDialog inside a Dialogfragment

自闭症网瘾萝莉.ら 提交于 2019-12-11 17:55:57
问题 I created a DialogFragment that has an EditText , and when the user presses the EditText there is a new DatePickerDialog that suppose to pick a date from the user and then set it in the DialogFragment . I am having a hard time to do so: The DatePickerDialog actually shows up but destroys the old DialogFragment . When I click ok/whatever I return to the activity. I want to pass the date that I picked back to the fragment. It was easier if I wanted to pass it back to an activity because I can

DialogFragment's width takes the whole screen unlike AlertDialog

风格不统一 提交于 2019-12-11 17:13:27
问题 I am trying to inflate a CustomView in my dialogFragment class, it works fine but the width takes the whole screen (90%) but if I inflate the same layout in AlertDialog, it just Works fine i.e width seems proper & good. I also tried setting the DialogFragment's width via onStart() but it wasn't the desired result... This is what I want (CustomView in AlertDialog) but here's the Result via DialogFragment - more width is taken as compared to AlertDialog! Layout File - <?xml version="1.0"

Return a callback (Open a DialogFragment from within a CustomView)

自古美人都是妖i 提交于 2019-12-11 13:13:12
问题 This is related to my previous question here: Open a DialogFragment from within a CustomView I now need to use a callback to return a value from my DialogFragment. I understand that something like this is commonly done: public class MyDialogFragment extends DialogFragment { public interface onMultipleSelectionFragmentCloseListener { public void onMultipleSelectionFragmentOkay(); } onMultipleSelectionFragmentCloseListener mListener; @Override public void onAttach(Activity activity) { super

Android: open dialog on adapter

给你一囗甜甜゛ 提交于 2019-12-11 12:22:13
问题 How do I open a DialogFragment inside a RecyclerView Adapter, or how do I do it through the main activity? I need to open it by clicking on every view that is added into the RecyclerView. 回答1: This is what I normally do when dealing with recyclerView items click events: Create a click listener to reuse later. public class RecyclerItemClickListener implements RecyclerView.OnItemTouchListener { @SuppressWarnings("CanBeFinal") private OnItemClickListener mListener; public interface

Why can I use onClick in an activity/feed, but, NOT in a dialog fragment?

老子叫甜甜 提交于 2019-12-11 11:19:56
问题 On Android here is for example an excellent code fragment, showing how to achieve five buttons on a dialog fragment ... android DialogFragment android:onClick="buttonCancel" causes IllegalStateException could not find a method in your DialogFragment, you have to setOnClickListener(this) for all of your buttons/imageviews etc. Then you implement View.OnClickListener and have a routine like this... public void onClick(View v) { Utils.Log("Fucking 'A' sort of... "); switch (v.getId()) { case R

DialogFragment behaves differently when invoked via ActionBar

烈酒焚心 提交于 2019-12-11 10:27:37
问题 I'm experiencing strange, perhaps version-specific behavior with my DialogFragment subclass when testing the following steps: (1) Open the dialog (2) Leave the app with either the Home key or the Recent Apps key (3) Return to the app, and the dialog is no longer visible. It seems to be briefly, translucently visible behind the main activity. (4) Rotate the device, and the dialog re-appears. This bug occurs on my Asus TF700T pad running Android 4.2.1, and it does not occur on my Motorola Razr

Custom number picker inside fragment

谁说胖子不能爱 提交于 2019-12-11 03:52:37
问题 Please, help me with using NumberPicker from https://github.com/SimonVT/android-numberpicker. I have fragment inside which I have button. After clicking button I want to show my number picker (as a pop-up, not new screen). So what I did: I created NumberPickerCustomDialog public class NumberPickerCustomDialog extends DialogFragment { Context context; @Override public Dialog onCreateDialog(Bundle savedInstanceState) { // get context context = getActivity().getApplicationContext(); // make