title: Get the fragment name or id
body: <p>I have a <code>framelayout</code> called one time in my <code>Activity</code> and various time in other <code>Fragment</code> (passing by the same <code>framelayout</code> of the <code>Activity</code>).</p>
  <p>In my <code>MainActivity.class</code>, I need to know in what fragment is my <code>framelayout</code>.
  For example, I need to know if <code>framelayout</code> is using <code>MyFragment1.class</code> or <code>MyFragment2.class</code>.</p>
  <p>I need something like this (in this example, the <code>log</code> have to say me <em>&quot;you are in MyFragment1&quot;</em>):</p>
  <pre><code>FrameLayout frameLayout = (FrameLayout) findViewById(R.id.framelayout);
  
   getSupportFragmentManager().beginTransaction()
          .replace(R.id.framelayout,new MyFragment1())
          .commit();
  
  if (framelayout.getname.equals(&quot;package.MyFragment1.class&quot;))
   Log.d(&quot;debug&quot;, &quot;you are in MyFragment1&quot;);
  else if (framelayout.getname.equals(&quot;package.MyFragment2.class&quot;))
   Log.d(&quot;debug&quot;, &quot;you are in MyFragment2&quot;);
  </code></pre>
  <p>How can I do that?</p>