fix popup menu

This commit is contained in:
Page Asgardius 2022-09-09 20:05:00 -07:00
parent 3f759f4aa8
commit bf2fc6f37a
2 changed files with 3 additions and 3 deletions

View file

@ -125,7 +125,7 @@ public class MainActivity extends AppCompatActivity {
public void onLongClick(View view, int position) {
//System.out.println("Long click on "+Name.get(position).toString());
// Initializing the popup menu and giving the reference as current context
PopupMenu popupMenu = new PopupMenu(MainActivity.this, recyclerView);
PopupMenu popupMenu = new PopupMenu(recyclerView.getContext(), view);
// Inflating popup menu from popup_menu.xml file
popupMenu.getMenuInflater().inflate(R.menu.account_menu, popupMenu.getMenu());

View file

@ -230,7 +230,7 @@ public class ObjectSelect extends AppCompatActivity {
if (Img.get(position).equals(R.drawable.folder)) {
//go to subfolder
/// Initializing the popup menu and giving the reference as current context
PopupMenu popupMenu = new PopupMenu(ObjectSelect.this, recyclerView);
PopupMenu popupMenu = new PopupMenu(recyclerView.getContext(), view);
// Inflating popup menu from popup_menu.xml file
popupMenu.getMenuInflater().inflate(R.menu.folder_menu, popupMenu.getMenu());
@ -249,7 +249,7 @@ public class ObjectSelect extends AppCompatActivity {
popupMenu.show();
} else {
// Initializing the popup menu and giving the reference as current context
PopupMenu popupMenu = new PopupMenu(ObjectSelect.this, recyclerView);
PopupMenu popupMenu = new PopupMenu(recyclerView.getContext(), view);
// Inflating popup menu from popup_menu.xml file
popupMenu.getMenuInflater().inflate(R.menu.object_menu, popupMenu.getMenu());