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:can.yrt.onebusaway.RegionsFragment.java

private void refresh() {
    setListShown(false);/* w  ww .  ja  v a  2 s.c  om*/
    setListAdapter(null);
    mAdapter = null;
    Bundle args = new Bundle();
    args.putBoolean(RELOAD, true);
    getLoaderManager().restartLoader(0, args, this);
}

From source file:com.friedran.appengine.dashboard.client.AppEngineDashboardClient.java

public AppEngineDashboardClient(Account account, Context context,
        AppEngineDashboardAuthenticator.OnUserInputRequiredCallback onUserInputRequiredCallback,
        PostExecuteCallback postAuthenticationCallback) {
    mAccount = account;//from  w  w  w.jav  a2 s .  c  om
    mApplicationContext = context.getApplicationContext();
    mPostAuthenticateCallback = postAuthenticationCallback;

    mLastRetrievedApplications = new ArrayList<String>();
    mHttpClient = new DefaultHttpClient();

    mAuthenticator = new AppEngineDashboardAuthenticator(mAccount, mHttpClient, mApplicationContext,
            onUserInputRequiredCallback, new AppEngineDashboardAuthenticator.PostAuthenticateCallback() {
                @Override
                public void run(boolean result) {
                    Bundle bundle = new Bundle();
                    bundle.putBoolean(KEY_RESULT, result);
                    mPostAuthenticateCallback.onPostExecute(bundle);
                }
            });
}

From source file:com.facebook.internal.BundleJSONConverterTest.java

@Test
public void testSimpleValues() throws JSONException {
    ArrayList<String> arrayList = new ArrayList<String>();
    arrayList.add("1st");
    arrayList.add("2nd");
    arrayList.add("third");

    Bundle innerBundle1 = new Bundle();
    innerBundle1.putInt("inner", 1);

    Bundle innerBundle2 = new Bundle();
    innerBundle2.putString("inner", "2");
    innerBundle2.putStringArray("deep list", new String[] { "7", "8" });

    innerBundle1.putBundle("nested bundle", innerBundle2);

    Bundle b = new Bundle();
    b.putBoolean("boolValue", true);
    b.putInt("intValue", 7);
    b.putLong("longValue", 5000000000l);
    b.putDouble("doubleValue", 3.14);
    b.putString("stringValue", "hello world");
    b.putStringArray("stringArrayValue", new String[] { "first", "second" });
    b.putStringArrayList("stringArrayListValue", arrayList);
    b.putBundle("nested", innerBundle1);

    JSONObject json = BundleJSONConverter.convertToJSON(b);
    assertNotNull(json);//w w w  .  ja va  2 s.  c  o  m

    assertEquals(true, json.getBoolean("boolValue"));
    assertEquals(7, json.getInt("intValue"));
    assertEquals(5000000000l, json.getLong("longValue"));
    assertEquals(3.14, json.getDouble("doubleValue"), TestUtils.DOUBLE_EQUALS_DELTA);
    assertEquals("hello world", json.getString("stringValue"));

    JSONArray jsonArray = json.getJSONArray("stringArrayValue");
    assertEquals(2, jsonArray.length());
    assertEquals("first", jsonArray.getString(0));
    assertEquals("second", jsonArray.getString(1));

    jsonArray = json.getJSONArray("stringArrayListValue");
    assertEquals(3, jsonArray.length());
    assertEquals("1st", jsonArray.getString(0));
    assertEquals("2nd", jsonArray.getString(1));
    assertEquals("third", jsonArray.getString(2));

    JSONObject innerJson = json.getJSONObject("nested");
    assertEquals(1, innerJson.getInt("inner"));
    innerJson = innerJson.getJSONObject("nested bundle");
    assertEquals("2", innerJson.getString("inner"));

    jsonArray = innerJson.getJSONArray("deep list");
    assertEquals(2, jsonArray.length());
    assertEquals("7", jsonArray.getString(0));
    assertEquals("8", jsonArray.getString(1));

    Bundle finalBundle = BundleJSONConverter.convertToBundle(json);
    assertNotNull(finalBundle);

    assertEquals(true, finalBundle.getBoolean("boolValue"));
    assertEquals(7, finalBundle.getInt("intValue"));
    assertEquals(5000000000l, finalBundle.getLong("longValue"));
    assertEquals(3.14, finalBundle.getDouble("doubleValue"), TestUtils.DOUBLE_EQUALS_DELTA);
    assertEquals("hello world", finalBundle.getString("stringValue"));

    List<String> stringList = finalBundle.getStringArrayList("stringArrayValue");
    assertEquals(2, stringList.size());
    assertEquals("first", stringList.get(0));
    assertEquals("second", stringList.get(1));

    stringList = finalBundle.getStringArrayList("stringArrayListValue");
    assertEquals(3, stringList.size());
    assertEquals("1st", stringList.get(0));
    assertEquals("2nd", stringList.get(1));
    assertEquals("third", stringList.get(2));

    Bundle finalInnerBundle = finalBundle.getBundle("nested");
    assertEquals(1, finalInnerBundle.getInt("inner"));
    finalBundle = finalInnerBundle.getBundle("nested bundle");
    assertEquals("2", finalBundle.getString("inner"));

    stringList = finalBundle.getStringArrayList("deep list");
    assertEquals(2, stringList.size());
    assertEquals("7", stringList.get(0));
    assertEquals("8", stringList.get(1));
}

From source file:can.yrt.onebusaway.RegionsFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    setHasOptionsMenu(true);//from w w w.jav a  2  s.  c  o m

    mLocation = LocationHelp.getLocation2(getActivity());
    mCurrentRegion = Application.get().getCurrentRegion();

    Bundle args = new Bundle();
    args.putBoolean(RELOAD, false);
    getLoaderManager().initLoader(0, args, this);
}

From source file:com.google.android.gms.samples.plus.SignInActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    outState.putBoolean(KEY_HAS_CALLED_GOOGLE_PLUS_API_ENDPOINT, mHasCalledGooglePlusApiEndpoint);
}

From source file:com.actinarium.rhythm.sample.RhythmSandbox.java

public void onSaveInstanceState(Bundle outState) {
    outState.putBoolean(ARG_RENDER, mDoRender);
}

From source file:com.nextgis.firereporter.HttpGetter.java

@Override
protected void onPostExecute(Void unused) {
    super.onPostExecute(unused);
    DismissDowloadDialog();/*from   w  ww  .j a v  a2 s.c o  m*/
    if (mError != null) {
        Bundle bundle = new Bundle();
        bundle.putBoolean(GetFiresService.ERROR, true);
        bundle.putString(GetFiresService.ERR_MSG, mError);
        bundle.putInt(GetFiresService.SOURCE, mnType);

        Message msg = new Message();
        msg.setData(bundle);

        if (mEventReceiver != null) {
            mEventReceiver.sendMessage(msg);
        }
    } else {
        //Toast.makeText(MainActivity.this, "Source: " + Content, Toast.LENGTH_LONG).show();
    }
}

From source file:com.nextgis.firereporter.ScanexHttpLogin.java

@Override
protected void onPostExecute(Void unused) {
    super.onPostExecute(unused);
    if (mbShowProgress) {
        mDownloadDialog.dismiss();/*  www.  jav a 2 s  .  c  o  m*/
    }
    if (mError != null) {
        Bundle bundle = new Bundle();
        bundle.putBoolean(GetFiresService.ERROR, true);
        bundle.putString(GetFiresService.ERR_MSG, mError);
        bundle.putInt(GetFiresService.SOURCE, mnType);

        Message msg = new Message();
        msg.setData(bundle);
        if (mEventReceiver != null) {
            mEventReceiver.sendMessage(msg);
        }
    }
}

From source file:fr.cph.chicago.activity.BaseActivity.java

@Override
public final void onSaveInstanceState(final Bundle savedInstanceState) {
    savedInstanceState.putBoolean("error", mError);
    super.onSaveInstanceState(savedInstanceState);
}

From source file:com.smartx.bill.mepad.mestore.uimgloader.AbsListViewBaseActivity.java

@Override
public void onSaveInstanceState(Bundle outState) {
    outState.putBoolean(STATE_PAUSE_ON_SCROLL, pauseOnScroll);
    outState.putBoolean(STATE_PAUSE_ON_FLING, pauseOnFling);
}