There is a recycleView for which longClick is set:

how do i pass item item in appWidgetProvider?

@Override public void onLongClick(View view, int position) { MainActivity.this.openContextMenu(view); } @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); if (v.getId() == R.id.recycle_view){ MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu_recycle, menu); } } @Override public boolean onContextItemSelected(MenuItem item) { AdapterContextMenuInfo menuInfo = (AdapterContextMenuInfo) item.getMenuInfo(); switch (item.getItemId()){ case R.id.move: /* ????? */ break; } return super.onContextItemSelected(item); } 
  • one
  • An error occurs, String resource ID # 0x1, did everything as described, but after installing onContextItemSelected in the activity itself, and after trying to deduce the position, I get such an error, have you not met? Perhaps the adapter is incorrectly transmitting - Anton Lyalin
  • It turns out that Toast passed an int variable, which it does not perceive, because of this it received such an error. - Anton Lyalin
  • Problem solved using How to create context menu for RecyclerView - Anton Lyalin

0