@Override
          public void drag(int from, int to) {
            if (from == to) {
              return;
            }
            List<AccountIndex> accounts = accountDb.getAccounts();
            AccountIndex firstIndex = accounts.get(from);
            AccountIndex secondIndex = accounts.get(to);
            try {
              // drag callback is fired in a worker thread, swapping the Ids doesn't affect the UI
              // thread.
              accountDb.swapId(firstIndex, secondIndex);
            } catch (AccountDbIdUpdateFailureException e) {
              Toast.makeText(
                      getApplicationContext(), R.string.accounts_reorder_failed, Toast.LENGTH_SHORT)
                  .show();
            }
            PinInfo.swapIndex(users, from, to);
          }
Called when the activity is first created.
java/com/google/android/apps/authenticator/AuthenticatorActivity.java