Libraryless. Click here for Pure Java version (1741L/11K).
import android.view.*; import android.view.Menu; import android.view.MenuItem; svoid aRemoveItemFromMenu(final Menu menu, fS title) { if (menu == null || title == null) ret; androidUI { for (int i = 0; i < menu.size(); i++) { MenuItem item = menu.getItem(i); if (eqic(str(item.getTitle()), title)) { int id = item.getItemId(); print("Removing menu item " + id); int n = menu.size(); menu.removeItem(id); bool removed = menu.size() < n; if (!removed) print("Could not remove menu item"); else { print("Removed"); i--; } } } } }
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1023366 |
Snippet name: | aRemoveItemFromMenu |
Eternal ID of this version: | #1023366/13 |
Text MD5: | 24607894b458ba5efaf0d006c61f6f00 |
Transpilation MD5: | 2116375df7e71ef270e2fbc679d10ed2 |
Author: | stefan |
Category: | javax / android |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-06-10 15:55:20 |
Source code size: | 635 bytes / 21 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 338 / 451 |
Version history: | 12 change(s) |
Referenced in: | [show references] |