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