How To find my current Displayed Fragment in my custom fragment
<p>I want to know in which fragment view am i? For fragment i used my different approach ,below is my code for that. Please help me how to do this. This is My completecode for HomeActivity. Another class is MainMenuActivity. when i placed MainMenuActivity ontop of HomeActivity i need to get the class name of MainMenuActivity how can i get it. </p>

<pre><code>  public class HomeActivity extends FragmentActivity implements OnClickListener {

    /*
     * Declaration Section
     */

    /**
     * Opens Display Fragment
     */
    Button mDisplayButton = null;

    /**
     * Opens Settings Fragment
     */
    Button mSettingsButton = null;

    /**
     * Opens Help Fragment
     */
    Button mHelpButton = null;

    View view = null;

    String digitalString = "Digital";
    String gaugeString = "Gauge";

    String mainMenuActivity= "MainMenuActivity";

    /**
     * 
     */
    FragmentManager fragmentManager = null;
    FragmentTransaction fragmentTransaction = null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.homeactivity);

        // Initialize buttons
        mDisplayButton = (Button) findViewById(R.id.btn_home_display);
        mSettingsButton = (Button) findViewById(R.id.btn_home_settings);
        mHelpButton = (Button) findViewById(R.id.btn_home_help);

        // Set listeners
        mDisplayButton.setOnClickListener(this);
        mSettingsButton.setOnClickListener(this);
        mHelpButton.setOnClickListener(this);

        fragmentManager = getSupportFragmentManager();
        fragmentTransaction = fragmentManager.beginTransaction();

        // Load display as the default fragment
        MainMenuActivity mMainMenuActivity = new MainMenuActivity();
        fragmentTransaction = fragmentManager.beginTransaction();
        fragmentTransaction.replace(R.id.holder_fragment, mMainMenuActivity, "MainMenuActivity");
        fragmentTransaction.commit();

        /*MainMenuActivity viewer = null;
        try {
            viewer = (MainMenuActivity) getFragmentManager().findFragmentByTag("MainMenuActivity");
            if (viewer.isVisible()) {
                   // add your code here
                }
        } catch (ClassCastException e) {
            // not that fragment
        }
        */

        view = getWindow().getDecorView().findViewById(android.R.id.content).getRootView();
        System.out.print("I am in HELP FRAGMENT"+ view);
    }



    @Override
    public void onClick(View view) {

        switch (view.getId()) {

        case R.id.btn_home_display:

            showDisplayDialog();
            break;

        case R.id.btn_home_settings:

            // Load Setting fragment
            settingsFragment();
            break;

        case R.id.btn_home_help:

            // Load help fragment
            HelpFragment mHelpFragment = new HelpFragment();
            fragmentTransaction = fragmentManager.beginTransaction();
            fragmentTransaction.replace(R.id.holder_fragment, mHelpFragment);
            fragmentTransaction.commit();

            break;
        }

    }

    /**
     * Call for Settings Fragment
     */

    public void settingsFragment()
    {
        SettingsFragment mSettingsFragment = new SettingsFragment();
        fragmentTransaction = fragmentManager.beginTransaction();
        fragmentTransaction.replace(R.id.holder_fragment, mSettingsFragment);
        fragmentTransaction.commit();
    }

    /**
     * Below Method for Display Graph Type
     */
    private void showDisplayDialog() {

        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle(R.string.choose_display_type);
        builder.setIcon(R.drawable.ic_launcher);
        builder.setItems(R.array.display_values,new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int item) {
                // Toast.makeText(getApplicationContext(), items[item],
                if (item == 0) {

                    if(PairWithSensorFragment.condition)
                    {
                        // It Display the digital screen
                        DisplayFragment mDisplayFragment = new DisplayFragment();
                        fragmentTransaction = fragmentManager.beginTransaction();
                        Bundle args = new Bundle();
                        args.putString("digital", digitalString);
                        mDisplayFragment.setArguments(args);
                        fragmentTransaction.replace(R.id.holder_fragment, mDisplayFragment);
                        fragmentTransaction.commit();

                    }else
                    {
                        // Loads Settings fragment
                        settingsFragment();
                    }


                } else if (item == 1) {

                    // It display the digital screen
                    GraphFragment mGraphFragment = new GraphFragment();
                    fragmentTransaction = fragmentManager.beginTransaction();
                    fragmentTransaction.replace(R.id.holder_fragment, mGraphFragment);
                    fragmentTransaction.commit();

                } else if (item == 2) {

                    if(PairWithSensorFragment.condition)
                    {
                        // It Display fragment
                        DisplayFragment mGaugeDisplayFragment = new DisplayFragment();
                        fragmentTransaction = fragmentManager.beginTransaction();
                        Bundle bundle = new Bundle();
                        bundle.putString("gauge", gaugeString);
                        mGaugeDisplayFragment.setArguments(bundle);
                        fragmentTransaction.replace(R.id.holder_fragment, mGaugeDisplayFragment);
                        fragmentTransaction.commit();
;
                    }else
                    {
                        // Loads Settings fragment
                        settingsFragment();
                    }
                }

            }
        });
        AlertDialog alert = builder.create();

        alert.show();

    }

} 
</code></pre>

<p>Another Class Code  is Here</p>

<pre><code>FragmentManager fragmentManager = null;
    FragmentTransaction fragmentTransaction = null;

    public MainMenuActivity(){

    }

    @Override
    public void onAttach(Activity activity) {
        // TODO Auto-generated method stub
        super.onAttach(activity);
    }


    @Override
    public void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        fragmentManager = getActivity().getSupportFragmentManager();
        fragmentTransaction = fragmentManager.beginTransaction();

    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        View view = inflater.inflate(R.layout.mainmenuactivity, null);

        mDigitalButton = (Button)view.findViewById(R.id.btn_home_digital);
        mGraphButton = (Button)view.findViewById(R.id.btn_home_graph);
        mGaugeButton = (Button)view.findViewById(R.id.btn_home_gauge);
        mDigitalButton.setOnClickListener(this);
        mGraphButton.setOnClickListener(this);
        mGaugeButton.setOnClickListener(this);

        return view;
    }


    @Override
    public void onClick(View view) {
        // TODO Auto-generated method stub
        switch (view.getId()) {

        case R.id.btn_home_digital:

            // If the Device is paired with UWBT device then controll will enter into the loop

            if(PairWithSensorFragment.condition)
            {
                // Load Display fragment
                displayFragment();
            }else
            {
                // Load SettingsFragment fragment
                settingsFragment();
            }

            break;
</code></pre>
