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.abcvoipsip.ui.help.Help.java

public static Help newInstance() {
    Help instance = new Help();
    Bundle args = new Bundle();
    args.putBoolean(ARG_KILL_LOADING, false);
    instance.setArguments(args);/*from   w w  w .  j a  v a2  s.c o m*/
    return instance;
}

From source file:com.ryan.ryanreader.fragments.MainMenuFragment.java

/**
 * MainMenuFragment/*from www .  j a v  a 2 s  .c  om*/
 * 
 * @param force
 * @return
 */
public static MainMenuFragment newInstance(final boolean force) {

    final MainMenuFragment f = new MainMenuFragment();

    // Bundle1
    final Bundle bundle = new Bundle(1);
    bundle.putBoolean("force", force);
    f.setArguments(bundle);

    /*
     * public void setArguments(Bundle args)
     * 
     * Fragment????FragmentActivity?
     * Fragment?????Fragment??
     */
    return f;
}

From source file:com.normalexception.app.rx8club.fragment.LoginFragment.java

public static LoginFragment getInstance(boolean userClicked) {
    LoginFragment lf = new LoginFragment();
    Bundle args = new Bundle(1);
    args.putBoolean("userclick", userClicked);
    lf.setArguments(args);//w  ww .  ja  v a  2s.c  om
    return lf;
}

From source file:com.beesham.popularmovies.sync.MoviesSyncAdapter.java

public static void syncImmediately(Context context) {
    Bundle b = new Bundle();
    b.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
    b.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);

    ContentResolver.requestSync(getSyncAccount(context), context.getString(R.string.content_authority), b);
}

From source file:com.arellomobile.android.push.PushGCMIntentService.java

private static void generateNotification(Context context, Intent intent, Handler handler) {
    Bundle extras = intent.getExtras();
    if (extras == null) {
        return;/*w  w w  .j  a v  a2s  . c om*/
    }

    extras.putBoolean("foregroud", GeneralUtils.isAppOnForeground(context));

    String title = (String) extras.get("title");
    String link = (String) extras.get("l");

    // empty message with no data
    Intent notifyIntent;
    if (link != null) {
        // we want main app class to be launched
        notifyIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(link));
        notifyIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    } else {
        notifyIntent = new Intent(context, PushHandlerActivity.class);
        notifyIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);

        // pass all bundle
        notifyIntent.putExtra("pushBundle", extras);
    }

    // first string will appear on the status bar once when message is added
    CharSequence appName = context.getPackageManager().getApplicationLabel(context.getApplicationInfo());
    if (null == appName) {
        appName = "";
    }

    NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);

    NotificationFactory notificationFactory;

    //is this banner notification?
    String bannerUrl = (String) extras.get("b");

    //also check that notification layout has been placed in layout folder
    int layoutId = context.getResources().getIdentifier(BannerNotificationFactory.sNotificationLayout, "layout",
            context.getPackageName());

    if (layoutId != 0 && bannerUrl != null) {
        notificationFactory = new BannerNotificationFactory(context, extras, appName.toString(), title,
                PushManager.sSoundType, PushManager.sVibrateType);
    } else {
        notificationFactory = new SimpleNotificationFactory(context, extras, appName.toString(), title,
                PushManager.sSoundType, PushManager.sVibrateType);
    }
    notificationFactory.generateNotification();
    notificationFactory.addSoundAndVibrate();
    notificationFactory.addCancel();

    Notification notification = notificationFactory.getNotification();

    notification.contentIntent = PendingIntent.getActivity(context, 0, notifyIntent,
            PendingIntent.FLAG_UPDATE_CURRENT);

    if (mSimpleNotification) {
        manager.notify(PushManager.MESSAGE_ID, notification);
    } else {
        manager.notify(PushManager.MESSAGE_ID++, notification);
    }

    generateBroadcast(context, extras);
}

From source file:br.com.bioscada.apps.biotracks.fragments.ExportDialogFragment.java

public static ExportDialogFragment newInstance(boolean hideDrive) {
    Bundle bundle = new Bundle();
    bundle.putBoolean(KEY_HIDE_DRIVE, hideDrive);

    ExportDialogFragment fragment = new ExportDialogFragment();
    fragment.setArguments(bundle);/*from ww w .jav a2  s  .  c  om*/
    return fragment;
}

From source file:com.alchemiasoft.book.fragment.BooksFragment.java

/**
 * Creates a new instance of BookListFragment.
 *
 * @param context//  w  w  w.j  a v  a 2  s . c  o  m
 * @param owned   true to get only the owned books, false otherwise.
 * @return an instance of BookListFragment ready to be attached.
 */
public static BooksFragment create(Context context, boolean owned) {
    final BooksFragment fragment = new BooksFragment();
    final Bundle args = new Bundle();
    args.putBoolean(KEY_OWNED, owned);
    fragment.setArguments(args);
    return fragment;
}

From source file:com.creationgroundmedia.popularmovies.sync.MovieSyncAdapter.java

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.content_authority), bundle);
}

From source file:com.android.contacts.interactions.ImportDialogFragment.java

public static void show(FragmentManager fragmentManager, List<SimCard> sims, boolean includeVcf) {
    final ImportDialogFragment fragment = new ImportDialogFragment();
    final Bundle args = new Bundle();
    args.putBoolean(EXTRA_SIM_ONLY, !includeVcf);
    for (SimCard sim : sims) {
        final List<SimContact> contacts = sim.getContacts();
        if (contacts == null) {
            continue;
        }//from  www .j av a 2 s. c o m
        args.putInt(EXTRA_SIM_CONTACT_COUNT_PREFIX + sim.getSimId(), contacts.size());
    }

    fragment.setArguments(args);
    fragment.show(fragmentManager, TAG);
}

From source file:com.spoiledmilk.ibikecph.util.HttpUtils.java

public static Message JSONtoUserDataMessage(JsonNode result, UserData userData) {
    Message ret = new Message();
    Bundle data = new Bundle();
    if (result != null) {
        data.putBoolean("success", result.get("success").asBoolean());
        data.putString("info", result.get("info").asText());
        JsonNode dataNode = result.get("data");
        if (dataNode != null) {
            data.putInt("id", dataNode.get("id").asInt());
            data.putString("name", dataNode.get("name").asText());
            data.putString("email", dataNode.get("email").asText());
            if (dataNode.has("image_url"))
                data.putString("image_url", dataNode.get("image_url").asText());
        }/* w w  w.  j a  v  a2s . co  m*/
        ret.setData(data);
    }
    return ret;
}