michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: package org.mozilla.gecko.util; michael@0: michael@0: import android.util.SparseArray; michael@0: michael@0: public final class ActivityResultHandlerMap { michael@0: private SparseArray mMap = new SparseArray(); michael@0: private int mCounter = 0; michael@0: michael@0: public synchronized int put(ActivityResultHandler handler) { michael@0: mMap.put(mCounter, handler); michael@0: return mCounter++; michael@0: } michael@0: michael@0: public synchronized ActivityResultHandler getAndRemove(int i) { michael@0: ActivityResultHandler handler = mMap.get(i); michael@0: mMap.delete(i); michael@0: michael@0: return handler; michael@0: } michael@0: }