android-dialogfragment

Calling DialogFragment from Fragment

谁都会走 提交于 2019-12-05 07:40:44
I am trying to call a DialogFragment from my Fragment class. I have an ImageView, and would like to call my DialogFragment class in the onClickListener of the ImageView I have set up. I am getting an error in the onClick with the code I have set up trying to call the DialogFragment. I am getting an error on "show" stating "The method show(FragmentManager, String) in the type DialogFragment is not applicable for the arguments (FragmentManager, String)" and an error on "new Instance" stating "The method newInstance() is undefined for the type MyDialogFragment" Here's my code: @Override public

DialogFragment Close Event

大兔子大兔子 提交于 2019-12-05 02:17:12
I need to handle the end of a DialogFragment (after a call to .dismiss) - for example, I would show a toast inside the activity that "contains" the fragment after dismiss. How do I handle the event? Override onDismiss() in your DialogFragment, or use setOnDismissListener() in the code block where you are building the fragment. Krzysiek I faced similar problem, but I wanted to inform another activity about the dialog dismiss (not the activity that created and showed the dialog). Although you can just override the onDismiss() method in your DialogFragment as Austyn Mahoney suggested, yet you can

Shared Element Transition not working

夙愿已清 提交于 2019-12-04 22:48:29
I have made a github project with just the issue. You can see it / clone it / build it from here: https://git.io/vMPqb I am trying to get shared elements working for a Fragment transition. There are two FABs in the project - Feather and Plane. Feather and Plane are shared elements. When Feather is clicked, the SheetDialog is opened, and Feather should animate over to Plane dialog. It does not do that at the moment, and I am trying to determine why. It may be worthwhile noting that I am running this on API 24 so issues with transitions not being supported below version 21 is not the problem.

In a DialogFragment, what should onCreate do?

老子叫甜甜 提交于 2019-12-04 19:09:55
I am currently messing around with DialogFragment to learn to use it. I assumed that compared to onCreateView() , onCreate() can do this: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); testTextView.setText("SUCCESS!"); //ERROR HERE } But I am wrong. Not sure why its not working. The error goes away when I comment out testTextView.setText("Success!"); The error is a NullPointerException, and then it just flags line 39 which is where the offending line of code is. Any clarifications much appreciated. EDIT: public View onCreateView(LayoutInflater inflater,

Show DialogFragment from another DialogFragment

為{幸葍}努か 提交于 2019-12-04 16:50:14
问题 I have a DialogFragment that displays a list of options to the user, one of these options is "Delete" option, when the user presses the delete option I want to show another DialogFragment as a confirmation, unfortunately, the confirmation dialog doesn't show. here is my code First Fragment code public class ContactDialogOption extends SherlockDialogFragment { public static final String TAG = ContactDialogOption.class.getSimpleName(); public ContactDialogOption() { super(); // TODO Auto

Nullpointerexcepiton on cursor while selecting photo from gallery on dialog fragment

♀尐吖头ヾ 提交于 2019-12-04 14:07:07
I'm trying to select photo from gallery through DialogFragment . But I'm getting nullpointerexception while initializing cursor . Any ideas why getting this error? Below is my code : if (resultCode == Activity.RESULT_OK) { Uri selectedImage = imageReturnedIntent.getData(); String[] filePathColumn = {MediaStore.Images.Media.DATA}; // Nullpointerexcepiton on this line Cursor cursor = getActivity().getContentResolver().query(selectedImage, filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); cursor.close(); } Here is my logcat error

Hide to show and hide keyboard in DialogFragment

孤街浪徒 提交于 2019-12-04 12:26:18
问题 In my dialog fragment, I am able to show the keyboard using getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT STATE_VISIBLE); but I am not able to hide it on dismiss . I've tried getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); and getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); neither of which work. I've also tried showing and hiding the keyboard using

Android DialogFragment with AppCompat theme issue

橙三吉。 提交于 2019-12-04 10:38:11
问题 I've trying to create DialoFragment with AppCompat theme, but when i use AppCompat theme, dialog title is not shown. I'am using defined style: <style name="DialogFragment" parent="Theme.AppCompat.Light.Dialog"/> When parent theme will be changed to: <style name="DialogFragment" parent="android:Theme.Material.Light.Dialog"/> or <style name="DialogFragment" parent="android:Theme.Holo.Light.Dialog"/> title is displaying properly. Code of my dialog: public class InfoDialog extends DialogFragment

Custom Dialog with setMultiChoiceItems

坚强是说给别人听的谎言 提交于 2019-12-04 09:25:37
问题 I want to create a way users can select options like the image below Right now am doing the following public static class CategoriesDialogFragment extends SherlockDialogFragment { public static CategoriesDialogFragment newInstance(int title) { CategoriesDialogFragment frag = new CategoriesDialogFragment(); Bundle args = new Bundle(); args.putInt("title", title); frag.setArguments(args); return frag; } @Override public Dialog onCreateDialog(Bundle savedInstanceState) { int title = getArguments

Set status bar color from DialogFragment

感情迁移 提交于 2019-12-04 09:13:43
问题 I'm creating an app which changes status bar color dynamically. My method in main Activity class works fine when called from any fragment. Fragments are placed in Activity pager: public void setStatusBarColorIfPossible(int color) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { getWindow().setStatusBarColor(color); } } However, in DialogFragment which is created in any fragment and made fullscreen, calling my method has no effect. Status bar is instantly black (as set in styles