Example usage for android.os Bundle putBoolean

List of usage examples for android.os Bundle putBoolean

Introduction

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

Prototype

public void putBoolean(@Nullable String key, boolean value) 

Source Link

Document

Inserts a Boolean value into the mapping of this Bundle, replacing any existing value for the given key.

Usage

From source file:com.adkdevelopment.earthquakesurvival.data.syncadapter.SyncAdapter.java

/**
 * Helper method to have the sync adapter sync immediately
 *
 * @param context The context used to access the account service
 *///from www . j av  a2 s  . c  om
public static void syncImmediately(Context context) {
    Bundle bundle = new Bundle();
    bundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
    bundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
    ContentResolver.requestSync(getSyncAccount(context), context.getString(R.string.sync_provider_authority),
            bundle);
}

From source file:com.hybris.mobile.app.commerce.CommerceApplicationBase.java

/**
 * Update the ContentServiceHelper and SyncAdapter url
 *
 * @param url/*from  w  ww .  j a  va2s  .c o m*/
 * @param catalog
 * @param catalogId
 * @param catalogMainCategoryId
 */
public static void updateUrl(String url, String catalog, String catalogId, String catalogMainCategoryId) {
    // Cancelling all the requests first
    mInstance.mContentServiceHelper.cancelAll();

    // For the catalog sync adapter
    Bundle bundle = new Bundle();
    bundle.putBoolean(CatalogSyncConstants.SYNC_PARAM_CANCEL_ALL_REQUESTS, true);
    requestCatalogSyncAdapter(bundle);

    // Updating the configuration of the catalog sync adapter
    bundle = new Bundle();
    bundle.putString(CatalogSyncConstants.SYNC_PARAM_CONTENT_SERVICE_HELPER_URL, url);
    bundle.putString(CatalogSyncConstants.SYNC_PARAM_CONTENT_SERVICE_HELPER_CATALOG, catalog);
    bundle.putString(CatalogSyncConstants.SYNC_PARAM_CONTENT_SERVICE_HELPER_CATALOG_ID, catalogId);
    bundle.putString(CatalogSyncConstants.SYNC_PARAM_CONTENT_SERVICE_HELPER_CATALOG_VERSION_ID,
            mInstance.getString(R.string.url_path_catalog_version_id));
    bundle.putString(CatalogSyncConstants.SYNC_PARAM_CONTENT_SERVICE_HELPER_MAIN_CATEGORY_ID,
            catalogMainCategoryId);
    requestCatalogSyncAdapter(bundle);

    // Content service helper
    mInstance.mContentServiceHelper.updateConfiguration(url, catalog, catalogId,
            mInstance.getString(R.string.url_path_catalog_version_id), catalogMainCategoryId);
}

From source file:com.linkedin.android.eventsapp.EventFragment.java

public static final EventFragment newInstance(Event event) {
    EventFragment f = new EventFragment();
    Bundle bdl = new Bundle();
    bdl.putString(EXTRA_EVENT_NAME, event.getEventName());
    bdl.putInt(EXTRA_PICTURE_ID, event.getImageResourceId());
    bdl.putString(EXTRA_EVENT_LOCATION, event.getEventLocation());
    bdl.putLong(EXTRA_EVENT_DATE, event.getEventDate());
    bdl.putBoolean(EXTRA_EVENT_ATTENDING, event.getIsAttending());
    bdl.putParcelableArray(EXTRA_EVENT_ATTENDEES, event.getEventAttendees());
    f.setArguments(bdl);/*w w  w.  j av  a 2 s.c  om*/
    return f;
}

From source file:com.activiti.android.platform.provider.transfer.ContentTransferManager.java

public static void startSaveAsTransfer(Activity activity, String contentId, String contentUri) {
    Bundle settingsBundle = new Bundle();
    settingsBundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
    settingsBundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
    settingsBundle.putInt(ContentTransferSyncAdapter.ARGUMENT_MODE, ContentTransferSyncAdapter.MODE_SAVE_AS);
    settingsBundle.putString(ContentTransferSyncAdapter.ARGUMENT_CONTENT_URI, contentUri);
    settingsBundle.putString(ContentTransferSyncAdapter.ARGUMENT_CONTENT_ID, contentId);
    ContentResolver.requestSync(ActivitiAccountManager.getInstance(activity).getCurrentAndroidAccount(),
            ContentTransferProvider.AUTHORITY, settingsBundle);
}

From source file:com.activiti.android.platform.provider.transfer.ContentTransferManager.java

public static void downloadTransfer(Context activity, String name, String mimetype, String contentId) {
    Bundle settingsBundle = new Bundle();
    settingsBundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
    settingsBundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
    settingsBundle.putInt(ContentTransferSyncAdapter.ARGUMENT_MODE, ContentTransferSyncAdapter.MODE_OPEN_IN);
    settingsBundle.putString(ContentTransferSyncAdapter.ARGUMENT_FILE_PATH, name);
    settingsBundle.putString(ContentTransferSyncAdapter.ARGUMENT_CONTENT_ID, contentId);
    settingsBundle.putString(ContentTransferSyncAdapter.ARGUMENT_MIMETYPE, mimetype);
    ContentResolver.requestSync(ActivitiAccountManager.getInstance(activity).getCurrentAndroidAccount(),
            ContentTransferProvider.AUTHORITY, settingsBundle);
}

From source file:com.activiti.android.platform.provider.transfer.ContentTransferManager.java

public static void startShare(Activity activity, String contentId, String filepath, String mimetype) {
    Bundle settingsBundle = new Bundle();
    settingsBundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
    settingsBundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
    settingsBundle.putInt(ContentTransferSyncAdapter.ARGUMENT_MODE, ContentTransferSyncAdapter.MODE_SHARE);
    settingsBundle.putString(ContentTransferSyncAdapter.ARGUMENT_FILE_PATH, filepath);
    settingsBundle.putString(ContentTransferSyncAdapter.ARGUMENT_CONTENT_ID, contentId);
    settingsBundle.putString(ContentTransferSyncAdapter.ARGUMENT_MIMETYPE, mimetype);
    ContentResolver.requestSync(ActivitiAccountManager.getInstance(activity).getCurrentAndroidAccount(),
            ContentTransferProvider.AUTHORITY, settingsBundle);
}

From source file:com.android.contacts.preference.DisplayOptionsPreferenceFragment.java

public static DisplayOptionsPreferenceFragment newInstance(String newLocalProfileExtra,
        boolean areContactsAvailable) {
    final DisplayOptionsPreferenceFragment fragment = new DisplayOptionsPreferenceFragment();
    final Bundle args = new Bundle();
    args.putString(ARG_NEW_LOCAL_PROFILE, newLocalProfileExtra);
    args.putBoolean(ARG_CONTACTS_AVAILABLE, areContactsAvailable);
    fragment.setArguments(args);/*from w  w w. j  av a  2 s  . c om*/
    return fragment;
}

From source file:com.ravi.apps.android.newsbytes.sync.NewsSyncAdapter.java

/**
 * Instructs the sync adapter to sync immediately.
 *///from  w  ww .ja v a  2  s  .  c o m
public static void syncImmediately(Context context) {
    Log.d(LOG_TAG, context.getString(R.string.log_sync_immediately));

    Bundle bundle = new Bundle();
    bundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
    bundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
    ContentResolver.requestSync(getSyncAccount(context), context.getString(R.string.content_authority), bundle);
}

From source file:com.ichi2.anki.dialogs.CustomStudyDialog.java

public static CustomStudyDialog newInstance(int id, long did, boolean jumpToReviewer) {
    CustomStudyDialog f = new CustomStudyDialog();
    Bundle args = new Bundle();
    args.putInt("id", id);
    args.putLong("did", did);
    args.putBoolean("jumpToReviewer", jumpToReviewer);
    f.setArguments(args);/*w  ww  .j av  a  2  s  .co  m*/
    return f;
}

From source file:Main.java

@SuppressWarnings("unchecked")
public static Bundle addMapToBundle(HashMap<String, ?> map, Bundle bundle) {
    for (String key : map.keySet()) {
        Object value = map.get(key);
        if (value instanceof String) {
            bundle.putString(key, (String) value);
        } else if (value instanceof Integer) {
            bundle.putInt(key, (Integer) value);
        } else if (value instanceof Double) {
            bundle.putDouble(key, ((Double) value));
        } else if (value instanceof Boolean) {
            bundle.putBoolean(key, (Boolean) value);
        } else if (value instanceof HashMap) {
            bundle.putBundle(key, addMapToBundle((HashMap<String, Object>) value, new Bundle()));
        } else if (value instanceof ArrayList) {
            putArray(key, (ArrayList) value, bundle);
        }//  ww  w . j a  v a2  s  .c o  m
    }
    return bundle;
}