android-dialogfragment

DialogFragment not resizing when keyboard shown

柔情痞子 提交于 2019-11-28 07:31:30
I'm trying to use a SherlockDialogFragment to ask some input from the user. Everything works fine on my phone (Galaxy Nexus, 4.2), but on a smaller phone (emulator 2.3.3), when the keyboard shows up, it covers the two buttons of the DialogFragment, like this: My layout is inside a ScrollView, and I'm changing the softInputMode to SOFT_INPUT_ADJUST_RESIZE on my onViewCreated . I also tried SOFT_INPUT_ADJUST_PAN , and it didn't work MyCustomDialog.java public class AddTaskDialog extends SherlockDialogFragment implements OnDateSetListener{ //... @Override public void onViewCreated(View view,

java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState with DialogFragment

匆匆过客 提交于 2019-11-28 07:12:46
I am facing issue with DialogFragment / getSupportFragmentManager / Android version 4.x 01-10 19:46:48.228: E/AndroidRuntime(9879): java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState 01-10 19:46:48.228: E/AndroidRuntime(9879): at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1314) 01-10 19:46:48.228: E/AndroidRuntime(9879): at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1325) 01-10 19:46:48.228: E/AndroidRuntime(9879): at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord

Adding positive / negative Button to DialogFragment's Dialog

断了今生、忘了曾经 提交于 2019-11-28 07:10:55
I've already written a DialogFragment. Now I've realized that I want it to have a positive and a negative button just like an AlertDialog. How can I achieve such a thing while maintaining the code that I've written? public class DoublePlayerChooser extends DialogFragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setStyle(DialogFragment.STYLE_NORMAL,0); } @Override public Dialog onCreateDialog(Bundle savedInstanceState) { return new AlertDialog.Builder(getActivity()) .setTitle("title") .setPositiveButton("OK", new DialogInterface

Make bottomSheetDialog full screen over status bar

不问归期 提交于 2019-11-28 06:59:39
I recently used android.support.design.widget.BottomSheetDialogFragment. I wanted to do something which is similar to the Google contact app, its BottomSheet can overlay the toolbar and statusbar. However, when I use the BottomSheetDialogFragment to implement this, it turns out to this: As you can see the activity's toolbar is still visible. Here is my code of the BottomSheetDialogFragment : public class KeyDetailFragment extends BottomSheetDialogFragment { private BottomSheetBehavior.BottomSheetCallback mBottomSheetBehaviorCallback = new BottomSheetBehavior.BottomSheetCallback() { @Override

Android DialogFragment title not showing

我们两清 提交于 2019-11-28 06:44:36
When creating a custom DialogFragment, i set the title using the following: @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_dialog_add, container, false); // Setting title here getDialog().setTitle("Add New"); return v; } The above code works fine for me on API level older than 23. For API 23 the title is not showing at all. Any idea why? and how to make the title show on API 23? Solved by adding the following to the styles.xml: <item name="android:dialogTheme">@style/CustomDialog</item>

Trying to set text of EditText from DatePicker DialogFragment

白昼怎懂夜的黑 提交于 2019-11-28 06:23:47
问题 I am simply trying to get the date from a datepicker dialog I created from one of the many android datepicker tutorials I found online. I seem to be going wrong somewhere in the actual retrieving of the text date once it is selected. I have a DatePickerFragment class, which is called from a CreateEvent fragment which is nested inside my MainActivity activity class. This is the DatePicker: public class DatePickerFragment extends DialogFragment implements DatePickerDialog.OnDateSetListener {

ViewPager in DialogFragment - IllegalStateException: Fragment does not have a view

拈花ヽ惹草 提交于 2019-11-28 06:19:04
What I want to achieve From a FragmentActivity show a dialog when clicking an Action Button in the Action Bar DialogFragment - A Dialog without title TabHost - Tabs at the top of the dialog ViewPager with FragmentPagerAdapter - Swipable, which content is connected to the Tabs 2-3 Dialog Buttons (different subclasses of the Dialog, different buttons) - Are not supposed to be in one of the ViewPager 's Fragment , meaning the same buttons should remain at the bottom of the Dialog regardless of what Fragment the ViewPager is showing. The problem IllegalStateException: Fragment does not have a view

Android DialogFragment disappears after orientation change

我们两清 提交于 2019-11-28 04:53:57
I have a FragmentActivity support v4 class which implements two side by side (kind of like gmail) fragments and a button which can bring up a DialogFragment. This all works great unless I have an orientation change. When I have an orientation change the states of the Fragments are not saved. And the main problem is if I have a the FragmentDialog open, it simply disappears. I have set setRetainInstance(true); in all fragments but it did not help. In my manifest I included android:configChanges="orientation" but is still does not help. Here are my code samples, thank you for the help. public

Setting the size of a DialogFragment

谁都会走 提交于 2019-11-28 04:23:22
I have been trying many commands to setup the size of my DialogFragment . It only contains a color-picker, so I have removed the background and title of the dialog: getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE); getDialog().getWindow().setBackgroundDrawable( new ColorDrawable(android.graphics.Color.TRANSPARENT)); However I also want to position the dialog where I want and it is problematic. I use: WindowManager.LayoutParams params = getDialog().getWindow().getAttributes(); params.width = LayoutParams.WRAP_CONTENT; params.height = LayoutParams.WRAP_CONTENT; params.gravity =

How to properly retain a DialogFragment through rotation?

只谈情不闲聊 提交于 2019-11-28 03:14:44
I have a FragmentActivity that hosts a DialogFragment. The DialogFragment perform network requests and handles Facebook authentication, so I need to retain it during rotation. I've read all the other questions relating to this issue, but none of them have actually solved the problem. I'm using putFragment and getFragment to save the Fragment instance and get it again during activity re-creation. However, I'm always getting a null pointer exception on the call to getFragment in onRestoreInstanceState. I would also like to keep the dialog from being dismissed during rotation, but so far I can't