Popup menu in fragment does not appear
<p>Fairly new to android, I'm currently having some difficulties implementing a <code>PopupMenu</code> on my <code>ImageButton</code> in a Fragment. There are no errors in the code, the emulator is able to build successfully but upon clicking the <code>ImageButton</code>, the popup menu does not show up.</p>

<p>OneFragment.java</p>

<pre><code>public class OneFragment extends Fragment {

public OneFragment() {
    // Required empty public constructor
}
@Override
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View rootview = inflater.inflate(R.layout.fragment_one, container,false);

    ImageButton popupButton = (ImageButton)rootview.findViewById(R.id.chineseTelevision);
    popupButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {

            PopupMenu popupMenu = new PopupMenu(getActivity().getApplicationContext(), v);
            popupMenu.inflate(R.menu.menu_main);
            popupMenu.show();
        }
    });

    return inflater.inflate(R.layout.fragment_one, container, false);
  }
}
</code></pre>

<p>After applying Pavneet's solution (which is the right solution)</p>

<pre><code>return rootview;
</code></pre>

<p>I stumbled onto another error,</p>

<pre><code>android.view.InflateException: Binary XML file line #17: Failed to resolve attribute at index 6: TypedValue{t=0x3/d=0x486 "res/drawable/ic_menu_moreoverflow_material.xml" a=1 r=0x10803d6}
</code></pre>

<p>I found out that this error was caused android.support.v7.widget.PopupMenu.</p>

<p>This link has the solution but no explanation to why the widget caused the issue. Here <a href="https://stackoverflow.com/questions/27782846/popup-menu-in-custom-listview">Popup Menu in custom ListView</a></p>