The method show in DialogFragment is not applicable for the arguments (FragmentManager, String)

StackOverflow https://stackoverflow.com/questions/23614398

سؤال

public class MainActivity extends ActionBarActivity {
.
.
.
    public  void show_read_menu(Bundle args){

        Menux editNameDialog = new Menux();
        android.support.v4.app.FragmentManager fm =  getSupportFragmentManager();
        editNameDialog.setArguments(args);
        editNameDialog.show(fm, "fragment_edit_name");

    }
.
.
   public static class Menux extends DialogFragment {
   //nested class

Unable to call the DialogFragment from the main ActionBarActivity class as above getting error on the .show() method :The method show(FragmentManager, String) in the type DialogFragment is not applicable for the arguments (FragmentManager, String)

هل كانت مفيدة؟

المحلول

Answering my own question for some completeness. It seems it was a trivial import issue, Since I was switching from Activity to ActionBarActivity the previous import were causing the issue.

Problem was caused by below imports.

import android.app.ActionBar;
import android.app.ActionBar.OnNavigationListener;
import android.app.DialogFragment;

Solved the issue by replacing them with...

import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBar.OnNavigationListener;
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top