Example usage for android.os Bundle keySet

List of usage examples for android.os Bundle keySet

Introduction

In this page you can find the example usage for android.os Bundle keySet.

Prototype

public Set<String> keySet() 

Source Link

Document

Returns a Set containing the Strings used as keys in this Bundle.

Usage

From source file:babybear.akbquiz.ConfigActivity.java

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == REQUESTCODE_IMAGE) {
        if (resultCode == RESULT_OK) {
            Bundle d = data.getExtras();
            Set<String> keys = d.keySet();
            for (String key : keys) {
                Log.d(TAG, "key : " + key + " values : " + d.get(key));
            }//from w  ww.  j a  va 2s  .c  o m
            cfgEditor.putBoolean(Database.KEY_use_custom_background, true);
            cfgEditor.commit();
            cfgflipper.setBackgroundDrawable(Drawable.createFromPath(customBgImage.getPath()));
        }
        return;
    }

    if (weiboSsoHandler != null) {
        weiboSsoHandler.authorizeCallBack(requestCode, resultCode, data);
    }
}

From source file:com.neusou.artsy.Flickr.java

public String createRequestSignature(String secret, Bundle data) throws NoSuchAlgorithmException {
    Set<String> keys = data.keySet();
    String[] keysArray = new String[keys.size()];
    keys.toArray(keysArray);/*from  w  w w  . j a  v  a 2 s. co m*/
    Arrays.sort(keysArray);

    StringBuffer sb = new StringBuffer();
    sb.append(secret);
    for (String key : keysArray) {
        sb.append(key);
        sb.append(data.get(key));
    }

    MessageDigest md = MessageDigest.getInstance(SIGNATURE_DIGEST_ALGORITHM);
    md.update(sb.toString().getBytes());
    byte[] digested = md.digest();
    BigInteger bi = new BigInteger(1, digested);
    String signature = bi.toString(16);
    return signature;
}

From source file:br.org.funcate.dynamicforms.FragmentDetail.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.details, container, false);
    LinearLayout mainView = (LinearLayout) view.findViewById(R.id.form_linear);
    FragmentDetailActivity fragmentDetailActivity;
    try {//from  ww  w  .  j  av  a2s  .  c  o m
        FragmentActivity activity = getActivity();
        if (selectedFormName == null || sectionObject == null) {
            FragmentList fragmentList = (FragmentList) getFragmentManager().findFragmentById(R.id.listFragment);
            if (fragmentList != null) {
                selectedFormName = fragmentList.getSelectedItemName();
                sectionObject = fragmentList.getSectionObject();
                noteId = fragmentList.getNoteId();
            } else {
                if (activity instanceof FragmentDetailActivity) {
                    // case of portrait mode
                    fragmentDetailActivity = (FragmentDetailActivity) activity;
                    selectedFormName = fragmentDetailActivity.getFormName();
                    sectionObject = fragmentDetailActivity.getSectionObject();
                    noteId = fragmentDetailActivity.getNoteId();
                    workingDirectory = fragmentDetailActivity.getWorkingDirectory();
                    existingFeatureData = fragmentDetailActivity.getFeatureData();
                }
            }
        }
        if (selectedFormName != null) {
            JSONObject formObject = TagsManager.getForm4Name(selectedFormName, sectionObject);

            key2WidgetMap.clear();
            requestCodes2WidgetMap.clear();
            int requestCode = 666;
            keyList.clear();
            key2ConstraintsMap.clear();

            if (formObject != null) {// Test to get form configuration to this layer

                JSONArray formItemsArray = TagsManager.getFormItems(formObject);

                int length = ((formItemsArray != null) ? (formItemsArray.length()) : (0));
                for (int i = 0; i < length; i++) {
                    JSONObject jsonObject = formItemsArray.getJSONObject(i);

                    String key = "-"; //$NON-NLS-1$
                    if (jsonObject.has(TAG_KEY))
                        key = jsonObject.getString(TAG_KEY).trim();

                    String label = key;
                    if (jsonObject.has(TAG_LABEL))
                        label = jsonObject.getString(TAG_LABEL).trim();

                    String type = FormUtilities.TYPE_STRING;
                    if (jsonObject.has(TAG_TYPE)) {
                        type = jsonObject.getString(TAG_TYPE).trim();
                    }

                    boolean readonly = false;
                    if (jsonObject.has(TAG_READONLY)) {
                        String readonlyStr = jsonObject.getString(TAG_READONLY).trim();
                        readonly = Boolean.parseBoolean(readonlyStr);
                    }
                    // if attribute has a non printable char, force readonly mode.
                    if (Utilities.existUnprintableCharacters(key)) {
                        readonly = true;
                    }

                    Constraints constraints = new Constraints();
                    FormUtilities.handleConstraints(jsonObject, constraints);
                    key2ConstraintsMap.put(key, constraints);
                    String constraintDescription = constraints.getDescription();

                    Object o;
                    GView addedView = null;
                    if (type.equals(TYPE_STRING)) {
                        o = getValueFromExtras(jsonObject, key);
                        String value = ((String) o).trim();
                        addedView = FormUtilities.addEditText(activity, mainView, label, value, 0, 0,
                                constraintDescription, readonly);
                    } else if (type.equals(TYPE_STRINGAREA)) {
                        o = getValueFromExtras(jsonObject, key);
                        String value = ((String) o).trim();
                        addedView = FormUtilities.addEditText(activity, mainView, label, value, 0, 7,
                                constraintDescription, readonly);
                    } else if (type.equals(TYPE_DOUBLE)) {
                        o = getValueFromExtras(jsonObject, key);
                        String value = ((String) o).trim();
                        addedView = FormUtilities.addEditText(activity, mainView, label, value, 1, 0,
                                constraintDescription, readonly);
                    } else if (type.equals(TYPE_INTEGER)) {
                        o = getValueFromExtras(jsonObject, key);
                        String value = ((String) o).trim();
                        addedView = FormUtilities.addEditText(activity, mainView, label, value, 4, 0,
                                constraintDescription, readonly);
                    } else if (type.equals(TYPE_DATE)) {
                        o = getValueFromExtras(jsonObject, key);
                        String value = ((String) o).trim();
                        addedView = FormUtilities.addDateView(FragmentDetail.this, mainView, label, value,
                                constraintDescription, readonly);
                    } else if (type.equals(TYPE_TIME)) {
                        o = getValueFromExtras(jsonObject, key);
                        String value = ((String) o).trim();
                        addedView = FormUtilities.addTimeView(FragmentDetail.this, mainView, label, value,
                                constraintDescription, readonly);
                    } else if (type.equals(TYPE_LABEL)) {
                        String size = "20"; //$NON-NLS-1$
                        if (jsonObject.has(TAG_SIZE))
                            size = jsonObject.getString(TAG_SIZE);
                        String url = null;
                        if (jsonObject.has(TAG_URL))
                            url = jsonObject.getString(TAG_URL);

                        o = getValueFromExtras(jsonObject, key);
                        String value = ((String) o).trim();
                        addedView = FormUtilities.addTextView(activity, mainView, value, size, false, url);
                    } else if (type.equals(TYPE_LABELWITHLINE)) {
                        String size = "20"; //$NON-NLS-1$
                        if (jsonObject.has(TAG_SIZE))
                            size = jsonObject.getString(TAG_SIZE);
                        String url = null;
                        if (jsonObject.has(TAG_URL))
                            url = jsonObject.getString(TAG_URL);

                        o = getValueFromExtras(jsonObject, key);
                        String value = ((String) o).trim();
                        addedView = FormUtilities.addTextView(activity, mainView, value, size, true, url);
                    } else if (type.equals(TYPE_BOOLEAN)) {
                        o = getValueFromExtras(jsonObject, key);
                        String value = ((String) o).trim();
                        addedView = FormUtilities.addBooleanView(activity, mainView, label, value,
                                constraintDescription, readonly);
                    } else if (type.equals(TYPE_STRINGCOMBO)) {
                        JSONArray comboItems = TagsManager.getComboItems(jsonObject);
                        String[] itemsArray = TagsManager.comboItems2StringArray(comboItems);
                        o = getValueFromExtras(jsonObject, key);
                        String value = ((String) o).trim();
                        addedView = FormUtilities.addComboView(activity, mainView, label, value, itemsArray,
                                constraintDescription);
                    } else if (type.equals(TYPE_CONNECTEDSTRINGCOMBO)) {
                        LinkedHashMap<String, List<String>> valuesMap = TagsManager
                                .extractComboValuesMap(jsonObject);
                        o = getValueFromExtras(jsonObject, key);
                        String value = ((String) o).trim();
                        addedView = FormUtilities.addConnectedComboView(activity, mainView, label, value,
                                valuesMap, constraintDescription);
                    } else if (type.equals(TYPE_STRINGMULTIPLECHOICE)) {
                        JSONArray comboItems = TagsManager.getComboItems(jsonObject);
                        String[] itemsArray = TagsManager.comboItems2StringArray(comboItems);
                        o = getValueFromExtras(jsonObject, key);
                        String value = ((String) o).trim();
                        addedView = FormUtilities.addMultiSelectionView(activity, mainView, label, value,
                                itemsArray, constraintDescription);
                    } else if (type.equals(TYPE_PICTURES)) {

                        o = getValueFromExtras(jsonObject, FormUtilities.IMAGE_MAP);
                        Map<String, Map<String, String>> value = null;
                        String clazz = o.getClass().getSimpleName();
                        if (("bundle").equalsIgnoreCase(clazz)) {
                            Bundle imageMapBundle = (Bundle) o;

                            Bundle imageMapThumbnailBundle = imageMapBundle.getBundle("thumbnail");
                            Bundle imageMapDisplayBundle = imageMapBundle.getBundle("display");

                            if (imageMapThumbnailBundle != null && imageMapDisplayBundle != null) {
                                Set<String> keys = imageMapThumbnailBundle.keySet();
                                Iterator<String> itKeys = keys.iterator();

                                if (keys.size() > 0) {
                                    value = new HashMap<String, Map<String, String>>(keys.size());

                                    while (itKeys.hasNext()) {
                                        String keyMap = itKeys.next();
                                        Map<String, String> imagePaths = new HashMap<String, String>(2);
                                        imagePaths.put("thumbnail",
                                                (String) imageMapThumbnailBundle.get(keyMap));
                                        imagePaths.put("display", (String) imageMapDisplayBundle.get(keyMap));

                                        value.put(keyMap, imagePaths);
                                    }
                                }
                            }
                        }
                        addedView = FormUtilities.addPictureView(this, requestCode, mainView, label, value,
                                constraintDescription);
                    }
                    /*else if (type.equals(TYPE_SKETCH)) {
                    addedView = FormUtilities.addSketchView(noteId, this, requestCode, mainView, label, value, constraintDescription);
                    } */
                    else {
                        Toast.makeText(getActivity().getApplicationContext(),
                                "Type non implemented yet: " + type, Toast.LENGTH_LONG).show();
                    }
                    /*                    } else if (type.equals(TYPE_MAP)) {
                    if (value.length() <= 0) {
                        // need to read image
                        File tempDir = ResourcesManager.getInstance(activity).getTempDir();
                        File tmpImage = new File(tempDir, LibraryConstants.TMPPNGIMAGENAME);
                        if (tmpImage.exists()) {
                            byte[][] imageAndThumbnailFromPath = ImageUtilities.getImageAndThumbnailFromPath(tmpImage.getAbsolutePath(), 1);
                            Date date = new Date();
                            String mapImageName = ImageUtilities.getMapImageName(date);
                            
                            IImagesDbHelper imageHelper = DefaultHelperClasses.getDefaulfImageHelper();
                            long imageId = imageHelper.addImage(longitude, latitude, -1.0, -1.0, date.getTime(), mapImageName, imageAndThumbnailFromPath[0], imageAndThumbnailFromPath[1], noteId);
                            value = "" + imageId;
                        }
                    }
                    addedView = FormUtilities.addMapView(activity, mainView, label, value, constraintDescription);
                                        } else if (type.equals(TYPE_NFCUID)) {
                    addedView = new GNfcUidView(this, null, requestCode, mainView, label, value, constraintDescription);
                                        } else {
                    GPLog.addLogEntry(this, null, null, "Type non implemented yet: " + type);
                                        }*/
                    key2WidgetMap.put(key, addedView);
                    keyList.add(key);
                    requestCodes2WidgetMap.put(requestCode, addedView);
                    requestCode++;
                } // end of the form items loop
            } else {
                String size = "20"; //$NON-NLS-1$
                String url = null;
                String value = getResources().getString(R.string.error_while_loading_form_configuration);
                GView addedView = FormUtilities.addTextView(activity, mainView, value, size, true, url);
                String key = "-"; //$NON-NLS-1$
                key2WidgetMap.put(key, addedView);
                keyList.add(key);
                requestCodes2WidgetMap.put(requestCode, addedView);
            }

            LinearLayout btnLinear = (LinearLayout) mainView.findViewById(R.id.btn_linear);
            if (keyList.size() == 1) {
                Button btnSave = (Button) btnLinear.findViewById(R.id.saveButton);
                btnSave.setEnabled(false);
            }
            mainView.removeView(btnLinear);
            mainView.addView(btnLinear);
        }
    } catch (ParseException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
        Toast.makeText(getActivity().getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show();
    }

    return view;
}

From source file:com.canappi.connector.yp.yhere.HomeView.java

public void viewDidLoad() {

    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        Set<String> keys = extras.keySet();
        for (Iterator<String> iter = keys.iterator(); iter.hasNext();) {
            String key = iter.next();
            Class c = SearchView.class;
            try {
                Field f = c.getDeclaredField(key);
                Object extra = extras.get(key);
                String value = extra.toString();
                f.set(this, extras.getString(value));
            } catch (SecurityException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();//w  w  w.  ja v  a2  s . c o  m
            } catch (NoSuchFieldException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IllegalArgumentException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    } else {

    }

    homeViewIds = new HashMap();
    homeViewValues = new HashMap();

    isUserDefault = false;

    String restaurantButtonText = "";
    String restaurantButtonPressedText = "";

    restaurantButton = (Button) findViewById(R.id.restaurantButton);
    restaurantButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // Perform action on click
            goToRestaurantView(v);
        }
    });

    String groceryButtonText = "";
    String groceryButtonPressedText = "";

    groceryButton = (Button) findViewById(R.id.groceryButton);
    groceryButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // Perform action on click
            goToGroceryView(v);
        }
    });

    String gasButtonText = "";
    String gasButtonPressedText = "";

    gasButton = (Button) findViewById(R.id.gasButton);
    gasButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // Perform action on click
            goToGasView(v);
        }
    });

    String teatherButtonText = "";
    String teatherButtonPressedText = "";

    teatherButton = (Button) findViewById(R.id.teatherButton);
    teatherButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // Perform action on click
            goToTeatherView(v);
        }
    });

    String couponButtonText = "";
    String couponButtonPressedText = "";

    couponButton = (Button) findViewById(R.id.couponButton);
    couponButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // Perform action on click
            goToCouponView(v);
        }
    });

    String lubeButtonText = "";
    String lubeButtonPressedText = "";

    lubeButton = (Button) findViewById(R.id.lubeButton);
    lubeButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // Perform action on click
            goToLubeView(v);
        }
    });

    String gameButtonText = "";
    String gameButtonPressedText = "";

    gameButton = (Button) findViewById(R.id.gameButton);
    gameButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // Perform action on click
            goGameView(v);
        }
    });

    String bakeryButtonText = "";
    String bakeryButtonPressedText = "";

    bakeryButton = (Button) findViewById(R.id.bakeryButton);
    bakeryButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // Perform action on click
            goToBakeryView(v);
        }
    });

    String repairButtonText = "";
    String repairButtonPressedText = "";

    repairButton = (Button) findViewById(R.id.repairButton);
    repairButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // Perform action on click
            goToRepairView(v);
        }
    });

    if (isUserDefault) {
        termEditText.setText(retrieveFromUserDefaultsFor("term"), TextView.BufferType.EDITABLE);
    }

    String findButtonText = "Search";
    String findButtonPressedText = "";

    findButton = (Button) findViewById(R.id.findButton);
    findButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // Perform action on click
            goToSearchView(v);
        }
    });
    didSelectViewController();

}

From source file:org.peercast.core.PeerCastService.java

/**
 * <pre>/*from   w ww  .  j a  v a  2  s. co  m*/
 * native called:
 * 
 * AndroidPeercastApp:: 
 *   channelStart(ChanInfo *info) 
 *   channelUpdate(ChanInfo *info)
 *   channelStop(ChanInfo *info)
 * **/
private void notifyChannel(int notifyType, Bundle bInfo) {
    ChannelInfo info = new ChannelInfo(bInfo);
    String chId = info.getId();

    switch (notifyType) {
    case NOTIFY_CHANNEL_START:
        //Notification??
        activeChInfos.put(chId, info);
        isShowNotification = true;
        break;
    case NOTIFY_CHANNEL_UPDATE:
        if (activeChInfos.containsKey(chId))
            activeChInfos.put(chId, info);
        break;
    case NOTIFY_CHANNEL_STOP:
        activeChInfos.remove(chId);
        break;
    }

    if (BuildConfig.DEBUG) {
        String s = bInfo.getString("id");
        for (String key : bInfo.keySet())
            s += ", " + key + "=" + bInfo.get(key);
        Log.i(TAG, "notifyType_" + notifyType + ": " + s);
    }
}

From source file:in.rade.armud.armudclient.MainActivity.java

/**
 * Updates fields based on data stored in the bundle.
 *
 * @param savedInstanceState The activity state saved in the Bundle.
 *//*ww  w.  j  ava  2  s .co m*/
private void updateValuesFromBundle(Bundle savedInstanceState) {
    Log.i(LOCATION_TAG, "Updating values from bundle");
    if (savedInstanceState != null) {
        // Update the value of mRequestingLocationUpdates from the Bundle, and make sure that
        // the Start Updates and Stop Updates buttons are correctly enabled or disabled.
        if (savedInstanceState.keySet().contains(REQUESTING_LOCATION_UPDATES_KEY)) {
            mRequestingLocationUpdates = savedInstanceState.getBoolean(REQUESTING_LOCATION_UPDATES_KEY);
        }

        // Update the value of mCurrentLocation from the Bundle and update the UI to show the
        // correct latitude and longitude.
        if (savedInstanceState.keySet().contains(LOCATION_KEY)) {
            // Since LOCATION_KEY was found in the Bundle, we can be sure that mCurrentLocation
            // is not null.
            mCurrentLocation = savedInstanceState.getParcelable(LOCATION_KEY);
        }

        // Update the value of mLastUpdateTime from the Bundle and update the UI.
        if (savedInstanceState.keySet().contains(LAST_UPDATED_TIME_STRING_KEY)) {
            mLastUpdateTime = savedInstanceState.getString(LAST_UPDATED_TIME_STRING_KEY);
        }
        updateUI();
    }
}

From source file:com.neighbor.ex.tong.GcmIntentService.java

@Override
protected void onHandleIntent(Intent intent) {
    Bundle extras = intent.getExtras();
    GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(getApplicationContext());
    String messageType = gcm.getMessageType(intent);

    if (!extras.isEmpty()) {
        if (GoogleCloudMessaging.MESSAGE_TYPE_SEND_ERROR.equals(messageType)) {
            Log.e("GcmIntentService", "Send error : " + extras.toString());
        } else if (GoogleCloudMessaging.MESSAGE_TYPE_DELETED.equals(messageType)) {
            Log.e("GcmIntentService", "Deleted messages on server : " + extras.toString());
        } else if (GoogleCloudMessaging.MESSAGE_TYPE_MESSAGE.equals(messageType)) {
            String msg = "";
            String SenderCarNo = "";
            String Userseq = "";

            Iterator<String> iterator = extras.keySet().iterator();
            while (iterator.hasNext()) {
                String key = iterator.next();
                String value = extras.get(key).toString();
                try {
                    if (key.equals("MESSAGE"))
                        msg = URLDecoder.decode(value, "utf-8");
                    if (key.equals("SENDER_CAR_NUM"))
                        SenderCarNo = URLDecoder.decode(value, "utf-8");
                    if (key.equals("SENDER_SEQ")) {
                        Userseq = String.valueOf(value);
                    }//from  w  w w  .  j a  v a2  s . c  o  m
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }

            if (!msg.equalsIgnoreCase("UPDATE_OK") && !msg.equalsIgnoreCase("")) {

                ActivityManager am = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
                List<ActivityManager.RunningTaskInfo> services = am.getRunningTasks(Integer.MAX_VALUE);

                boolean isRunning = false;

                if (services.get(0).topActivity.getPackageName().toString()
                        .equalsIgnoreCase(this.getPackageName().toString())) {
                    isRunning = true;
                }

                if (false == isRunning) {
                    Uri path = getSoundPath(msg);
                    NotiMessage(msg, path);
                } else {
                    mHandler.post(new DisplayToast(this, msg));
                }

                //                    Log.d("hts", "sendGCMIntent msg : " + msg + "\t Userseq : " + Userseq + "\t SenderCarNo : " + SenderCarNo);
                sendGCMIntent(GcmIntentService.this, msg, null, SenderCarNo, Userseq);
            }
        }
    }

    GCMBroadCastReceiver.completeWakefulIntent(intent);
}

From source file:com.neusou.artsy.Flickr.java

public String createRequestString(Bundle data) throws Exception {

    String equals = "=";
    StringBuffer sb = new StringBuffer(BASE_ENDPOINT);
    Set<String> keys = data.keySet();
    boolean start = true;
    for (String key : keys) {
        if (!start) {
            sb.append("&");
        } else {// w  w  w . j a  v a  2s .c  o  m
            start = false;
        }
        sb.append(key);
        sb.append(equals);
        sb.append(data.getString(key));
    }
    return sb.toString();

}

From source file:org.zywx.wbpalmstar.engine.EBrowserActivity.java

private void getIntentData(Intent in) {
    if (null != in) {
        Bundle bundle = in.getExtras();
        if (null != bundle) {
            OtherAppData = new JSONObject();
            Set<String> set = bundle.keySet();
            Iterator<String> it = set.iterator();
            while (it.hasNext()) {
                try {
                    String key = it.next();
                    Object object = bundle.get(key);
                    if (object != null) {
                        String data = object.toString();
                        OtherAppData.put(key, data);
                    }//from   ww  w . j a v a  2s  .c o  m
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
            loadByOtherApp();
        }
    }
}

From source file:org.camlistore.UploadService.java

private void handleSend(Intent intent) {
    Bundle extras = intent.getExtras();
    if (extras == null) {
        Log.w(TAG, "expected extras in handleSend");
        return;/*from   w w  w . j  a v  a  2s  .com*/
    }

    extras.keySet(); // unparcel
    Log.d(TAG, "handleSend; extras=" + extras);

    Object streamValue = extras.get("android.intent.extra.STREAM");
    if (!(streamValue instanceof Uri)) {
        Log.w(TAG, "Expected URI for STREAM; got: " + streamValue);
        return;
    }

    final Uri uri = (Uri) streamValue;
    Util.runAsync(new Runnable() {
        @Override
        public void run() {
            try {
                service.enqueueUpload(uri);
            } catch (RemoteException e) {
            }
        }
    });
}