last day (15 days later) » 

16:43
1
A: DialogFragment attaches to MainActivity instead of parent fragment activity

Mina Samyyour app crashes here mListener = (SensorRateChangeListener) activity; because it's expecting your Main Activity to be like this: public class MainAcivity extends Activity implements SensorRateChangeListener{ since you implemented the SensorRateChangeListener interface in another fragment,...

You're right, but where should I call the setOnSensorRateChangeListener?
In your Activity after creating a new instance of the fragment
In MainActivity? or in the FragmentActivity which calls the DialogFragment?
It depends on the class that implements the interface and hold the DialogFragment, it can be the MainActivity or the FragmentActivity, please check the updated answer above
In fragment, but what parameters should I pass to setOnSensorRateChangeListener?
Now I have this, but it crashes FragmentManager fm = getFragmentManager(); SensorRateChangeDlg dialogFragment = new SensorRateChangeDlg(); dialogFragment.setOnSensorRateChangeListener(this); dialogFragment.show(fm, "rate");
java.lang.IllegalStateException: You can not set Dialog's OnCancelListener or OnDismissListener
16:43
This is an another issue, I suggest posting it in a separate question and posting your code.
but the problem is still related to this question, I have not solved this problem with the FragmentDialog Listener.
Hi Mario
For your error, please check this link: stackoverflow.com/questions/14520597/…
I think it may help you
otherwise, please post more code to detect the problem
Good luck
I have posted a new quoestion here stackoverflow.com/questions/28012203/…
The code was working before in a simple MainActivity
But I have rewritten the app to use fragments and now it does not work

last day (15 days later) »