Reputation: 12333
I have a problem when using DialogFragment
DialogFragment dialog = new DateDialog(this);
dialog.setTargetFragment(this,1);
dialog.show(getFragmentManager(), "tag");
Where this
caused the error. my class extends FragmentActivity
.
I'm following this answer, but so far, cannot apply on my code. what do i do wrong ?
This is my class :
import android.app.AlertDialog;
import android.app.DatePickerDialog.OnDateSetListener;
import android.app.Dialog;
import android.app.DialogFragment;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.util.Log;
import android.view.View;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.support.v4.app.Fragment;
public class RegisterActivity extends FragmentActivity implements OnDateSetListener
{
}
Upvotes: 1
Views: 4850
Reputation: 986
Be sure you are using the correct DialogFragment:
http://developer.android.com/reference/android/app/DialogFragment.html
↳ android.app.Fragment
↳ android.app.DialogFragment
versus
↳ android.support.v4.app.Fragment
↳ android.support.v4.app.DialogFragment
It's easy to import the wrong class. Just look at which version of FragmentActivity you are using and pick the corresponding DialogFragment.
Upvotes: 4