What I want to achieve:
I have a custom ListView adapter. To each Listitem I want to add a popup menu, pretty similar to the ListView in the current Google Play appl
I fixed a similar error just by passing as parameter a static activity. For example:
static AppCompatActivity sActivity;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
sActivity = this;
yourLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
PopupMenu popup = new PopupMenu(sActivity, v);
MenuInflater inflater = popup.getMenuInflater();
inflater.inflate(R.menu.my_popup_menu, popup.getMenu());
popup.show();
}
});
}
Also, you problem might be this one: Issue 152141
Hopefully it will help you, respecting the android.support.v7.widget.PopupMenu
import.
Regards.