public boolean performAction(int itemId, int position) { switch (itemId) { case R.id.cap: String word=words.get(position); word=word.toUpperCase(); adapter.remove(words.get(position)); adapter.insert(word, position); return(true); case R.id.remove: adapter.remove(words.get(position)); return(true); } return(false); }
public void run() { listAdapter.remove(new DeviceDisplay(device)); } });
public boolean performActions(MenuItem item) { SparseBooleanArray checked=getListView().getCheckedItemPositions(); switch (item.getItemId()) { case R.id.cap: for (int i=0; i < checked.size(); i++) { if (checked.valueAt(i)) { int position=checked.keyAt(i); String word=words.get(position); word=word.toUpperCase(Locale.ENGLISH); adapter.remove(words.get(position)); adapter.insert(word, position); } } return(true); case R.id.remove: ArrayList<Integer> positions=new ArrayList<Integer>(); for (int i=0; i < checked.size(); i++) { if (checked.valueAt(i)) { positions.add(checked.keyAt(i)); } } Collections.sort(positions, Collections.reverseOrder()); for (int position : positions) { adapter.remove(words.get(position)); } getListView().clearChoices(); return(true); } return(false); }
public void run() { DeviceDisplay d = new DeviceDisplay(device); int position = listAdapter.getPosition(d); if (position >= 0) { // Device already in the list, re-set new value at same position listAdapter.remove(d); listAdapter.insert(d, position); } else { listAdapter.add(d); } } });
@Override public void remove(TabImpl tab) { // Need to make sure custom views are properly removed from their parent. detachFromParent(tab.getCustomView()); mCachedViews.remove(tab); super.remove(tab); updatePositions(false /* normal order */); if (isSelected(tab)) { setSelected(getCount() == 0 ? NONE : getItem(Math.max(0, tab.getPosition() - 1))); } tab.setPosition(Tab.INVALID_POSITION); }
@Test @SuppressWarnings("BoxedPrimitiveConstructor") public void test_remove() throws Exception { Integer firstItem = arrayAdapter.getItem(0); assertEquals(3, arrayAdapter.getCount()); assertEquals(new Integer(1), firstItem); arrayAdapter.remove(firstItem); assertEquals(2, arrayAdapter.getCount()); assertEquals(new Integer(2), arrayAdapter.getItem(0)); assertEquals(new Integer(3), arrayAdapter.getItem(1)); } }
ListPopup inflatePopupMenu(ArrayAdapter<ListPopup.Item> adapter, Context context) { ListPopup menu = new ListPopup(context); menu.setAdapter(adapter); // If app already pinned, do not display the "add to favorite" option // otherwise don't show the "remove favorite button" String favApps = PreferenceManager.getDefaultSharedPreferences(context). getString("favorite-apps-list", ""); if (favApps.contains(this.pojo.id + ";")) { for (int i = 0; i < adapter.getCount(); i += 1) { ListPopup.Item item = adapter.getItem(i); assert item != null; if (item.stringId == R.string.menu_favorites_add) adapter.remove(item); } } else { for (int i = 0; i < adapter.getCount(); i += 1) { ListPopup.Item item = adapter.getItem(i); assert item != null; if (item.stringId == R.string.menu_favorites_remove) adapter.remove(item); } } if (BuildConfig.DEBUG) { adapter.add(new ListPopup.Item("Relevance: " + pojo.relevance)); } return menu; }
@Override public void run() { try { // Remove device from list list.remove(d); } catch (Exception e) { e.printStackTrace(); } } });
@Override public void onClick(DialogInterface dialog, int item) { switch (item) { case 0: // Remove adapter.remove(channel); channels.remove(channel); okButton.setEnabled(true); break; } } });
@Override public void onClick(DialogInterface dialog, int item) { switch (item) { case 0: // Remove adapter.remove(alias); aliases.remove(alias); okButton.setEnabled(true); break; } } });
@Override public void onClick(DialogInterface dialog, int item) { switch (item) { case 0: // Remove adapter.remove(command); commands.remove(command); okButton.setEnabled(true); break; } } });
@Override public void remove(ItemChooserRow item) { String description = item.mDescription; if (mItemDescriptionMap.containsKey(description)) { int count = mItemDescriptionMap.get(description); if (count == 1) { mItemDescriptionMap.remove(description); } else { mItemDescriptionMap.put(description, count - 1); } } super.remove(item); }
@Override public void remove(int which) { String item = adapter.getItem(which); adapter.remove(item); listview.removeCheckState(which); }
ArrayAdapter adapter = //initialize with your Model Objects and set it as ListAdapter Object someItemInsideList = //some Item adapter.remove(someItemInsideList); adapter.insert(someItemInsideList, 0); adapter.notifyDataSetChanged();
@Override public void onLost(final Message message) { // Called when a message is no longer detectable nearby. mNearbyDevicesArrayAdapter.remove( DeviceMessage.fromNearbyMessage(message).getMessageBody()); } };
@Override public void onMidiOutputDeviceDetached(@NonNull final MidiOutputDevice midiOutputDevice) { if (connectedDevicesAdapter != null) { connectedDevicesAdapter.remove(midiOutputDevice.getUsbDevice()); connectedDevicesAdapter.notifyDataSetChanged(); } Toast.makeText(MIDIDriverMultipleSampleActivity.this, "USB MIDI Device " + midiOutputDevice.getUsbDevice().getDeviceName() + " has been detached.", Toast.LENGTH_LONG).show(); }
@Override public void drop(int from, int to) { if (from != to) { String item = adapter.getItem(from); adapter.remove(item); adapter.insert(item, to); listview.moveCheckState(from, to); } } }
@Override public void onMidiOutputDeviceAttached(@NonNull final MidiOutputDevice midiOutputDevice) { if (connectedDevicesAdapter != null) { connectedDevicesAdapter.remove(midiOutputDevice.getUsbDevice()); connectedDevicesAdapter.add(midiOutputDevice.getUsbDevice()); connectedDevicesAdapter.notifyDataSetChanged(); } Toast.makeText(MIDIDriverMultipleSampleActivity.this, "USB MIDI Device " + midiOutputDevice.getUsbDevice().getDeviceName() + " has been attached.", Toast.LENGTH_LONG).show(); }
@Override public void remove(EcuDataPv object) { object.remove(FID_GAUGE_SERIES); object.removePvChangeListener(this); object.setRenderingComponent(null); super.remove(object); }