Java Code Examples for android.widget.ArrayAdapter#sort()
The following examples show how to use
android.widget.ArrayAdapter#sort() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KeyAssignmentUtils.java From talkback with Apache License 2.0 | 5 votes |
/** * Updates the arrayadapter to reflect changes in the list of keys assigned. * * @param keyListAdapter The ArrayAdapter to be updated * @param keyCombos The present set of assigned keys * @param context The context of the activity the call came from */ public static void updateKeyListAdapter( ArrayAdapter<CharSequence> keyListAdapter, Set<Long> keyCombos, Context context) { keyListAdapter.clear(); for (long keyCombo : keyCombos) { keyListAdapter.add(KeyAssignmentUtils.describeExtendedKeyCode(keyCombo, context)); } /* Sort the list so the keys appear in a consistent place */ keyListAdapter.sort( (charSequence0, charSequence1) -> charSequence0.toString().compareToIgnoreCase(charSequence1.toString())); }
Example 2
Source File: ManageAddonsActivity.java From MCPELauncher with Apache License 2.0 | 5 votes |
private void receiveAddons(List<AddonListItem> addons) { this.addons = addons; List<String> allPaths = new ArrayList<String>(addons.size()); for (AddonListItem i : addons) { String name = i.appInfo.packageName; allPaths.add(name); } AddonManager.getAddonManager(this).removeDeadEntries(allPaths); ArrayAdapter<AddonListItem> adapter = new ArrayAdapter<AddonListItem>(this, R.layout.patch_list_item, addons); adapter.sort(new AddonListComparator()); setListAdapter(adapter); }
Example 3
Source File: PublicServerListFragment.java From Plumble with GNU General Public License v3.0 | 5 votes |
@Override public void onClick(DialogInterface dialog, int which) { ArrayAdapter<PublicServer> arrayAdapter = mServerAdapter; if(which == SORT_NAME) { arrayAdapter.sort(nameComparator); } else if(which == SORT_COUNTRY) { arrayAdapter.sort(countryComparator); } }