diff --git a/app/src/main/java/asgardius/page/s3manager/MainActivity.java b/app/src/main/java/asgardius/page/s3manager/MainActivity.java index faa368f..d00f020 100644 --- a/app/src/main/java/asgardius/page/s3manager/MainActivity.java +++ b/app/src/main/java/asgardius/page/s3manager/MainActivity.java @@ -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()); diff --git a/app/src/main/java/asgardius/page/s3manager/ObjectSelect.java b/app/src/main/java/asgardius/page/s3manager/ObjectSelect.java index ca3f38a..31bd839 100644 --- a/app/src/main/java/asgardius/page/s3manager/ObjectSelect.java +++ b/app/src/main/java/asgardius/page/s3manager/ObjectSelect.java @@ -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());