android-dialogfragment

OnCreateView not called in a dialogfragment from a fragment

浪尽此生 提交于 2019-12-11 03:37:10
问题 I have a fragment that executes or display a dialog fragment once a button is clicked. This dialog fragment displays a table generated by code, however when I try to click the button on this is displayed And when I trace it in the LogCat the dialog fragments onCreateView is not called. Can somebody help or explain this to me?. Im not that good in android programming yet and I know i still have a lot to learn. Here is the code of the fragment that calls the dialog fragment public class

Error inflating class android.widget.DatePicker on android version 7.0

爷,独闯天下 提交于 2019-12-11 00:15:45
问题 I want to show popup date picker and i using this code Calendar mcurrentDate = Calendar.getInstance(); int mYear = mcurrentDate.get(Calendar.YEAR); int mMonth = mcurrentDate.get(Calendar.MONTH); int mDay = mcurrentDate.get(Calendar.DAY_OF_MONTH); DatePickerDialog mDatePicker = new DatePickerDialog(getActivity(), new DatePickerDialog.OnDateSetListener() { public void onDateSet(DatePicker datepicker, int selectedyear, int selectedmonth, int selectedday) { txtDate1.setText(selectedmonth + "/" +

Incompatible types of fragment

自闭症网瘾萝莉.ら 提交于 2019-12-10 22:37:45
问题 Hi I have small app in android where Im using fragments with navigation drawer for menu. But now I want show in my fragments dialog popup window when user click on something and there I get these errors: MainActivity: private void displayView(int position) { // update the main content by replacing fragments Fragment fragment = null; switch (position) { case 0: fragment = new HomeFragment(); break; case 1: fragment = new FindPeopleFragment(); break; default: break; } if (fragment != null) {

Android: support DialogFragment with custom layout not shown

风格不统一 提交于 2019-12-10 17:16:08
问题 I've had a subclass of DialogFragment ( android.support.v4.app.DialogFragment ) in my app that worked fine for a long time. The dialog itself was constructed in onCreateDialog() callback. Now, however, I want to transition to a new dialogs layout and decided to construct a completely customized dialog. To my best knowledge, this requires removing override of onCreateDialog() and inflating a View hierarchy in onCreateView() callback. I did so. The resulting behavior is very strange - when the

onActivityResult in dialog fragment

我只是一个虾纸丫 提交于 2019-12-10 16:38:56
问题 I'm taking photo from dialog fragment. And also I need something like startActivityForResult(takePictureIntent, actionCode); @Override public void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent) { super.onActivityResult(requestCode, resultCode, imageReturnedIntent); switch (requestCode) { case SELECT_PHOTO: getActivity(); if (resultCode == Activity.RESULT_OK) { Uri selectedImage = imageReturnedIntent.getData(); String[] filePathColumn = { MediaStore.Images.Media

Animate an AlertDialog's entrance and exit

半城伤御伤魂 提交于 2019-12-10 16:19:50
问题 I have to slide in an AlertDialog when it enters and slide it out when it is dismissed, but it is not animating. So how do I get the animation to work ? Here is what I have, public class SlideDialogFragment extends DialogFragment { @Override public Dialog onCreateDialog(Bundle savedInstanceState) { return new AlertDialog.Builder(new ContextThemeWrapper(getActivity(),R.style.SlidingDialog)) .setTitle("Sliding dialog") .create() } themes.xml <?xml version="1.0" encoding="utf-8"?> <resources

Android Support DialogFragment crashes on screen rotation

社会主义新天地 提交于 2019-12-10 15:58:16
问题 I am trying to switch my app to use dialog fragments but I get an application crash when rotating the screen while the dialog is visible. I can reproduce this in a very simple app described below. Create a new project in Android studio and add a DialogFragment like so: public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState == null) {

How to use NumberPicker in Android app with API 7?

被刻印的时光 ゝ 提交于 2019-12-10 13:22:37
问题 The minimum sdk of my app is 7, but I can use DialogFragment which is from sdk version 11, because it is in the support library which is in my lib directory. I'd like to make something like this example: http://developer.android.com/guide/topics/ui/controls/pickers.html But I want to use the NumberPicker widget, which is from sdk version 11 too, but my app does not allow this. Do I have to add other support library? How can I use this component? Thank you. 回答1: Do I have to add other support

Why is DialogFragment.onCreateView called when Activity is being Destroyed?

不问归期 提交于 2019-12-10 12:48:22
问题 I'm using the android support library v4 revision 11 and time to time, I see the stack trace below ; I suspect it's happening due to a launch from recents, hence the model I'm trying to access is null. Anyhow, this trace has made me wonder why onCreateView is called when the activity is being destroyed, and what's the best way to handle such cases? java.lang.NullPointerException at com.example.dialogs.ExampleDialogFragment.onCreateView(ExampleDialogFragment.java:53) at android.support.v4.app

how to restrict user to select date of birth who is under 21 years in android

浪尽此生 提交于 2019-12-10 11:56:01
问题 I am using DatePickerDialog to select the users date of birth.How to restrict user to select date of birth who is under 21 years from current date. Eg:the users date of birth after 14/6/1996 should be restricted from selecting This is my code, Date today = new Date(); Calendar c = Calendar.getInstance(); c.setTime(today); c.add( Calendar.YEAR, -21 ); minDate= c.getTime().getTime(); Log.v(Constants.TAG, "selecteddsdf " + minDate); public void showDatePickerDialog(View v) { datePickerDialog =