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.clearcenter.mobile_demo.mdAuthenticator.java

public Bundle hasFeatures(AccountAuthenticatorResponse response, Account account, String[] features) {
    // This call is used to query whether the Authenticator supports
    // specific features. We don't expect to get called, so we always
    // return false (no) for any queries.
    Log.v(TAG, "hasFeatures()");
    final Bundle result = new Bundle();
    result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, false);
    return result;
}

From source file:com.imalu.alyou.activity.ConcernlistFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    if (((MainActivity) getActivity()).isConflict)
        outState.putBoolean("isConflict", true);
    super.onSaveInstanceState(outState);
}

From source file:com.hyrt.cnp.account.AccountAuthenticator.java

@Override
public Bundle hasFeatures(final AccountAuthenticatorResponse response, final Account account,
        final String[] features) throws NetworkErrorException {
    final Bundle result = new Bundle();
    result.putBoolean(KEY_BOOLEAN_RESULT, false);
    return result;
}

From source file:com.normalexception.app.rx8club.task.DeletePmTask.java

@Override
protected void onPostExecute(Void result) {
    try {//from w w  w.ja v  a2s.c  o  m
        mProgressDialog.dismiss();
        mProgressDialog = null;
    } catch (Exception e) {
        Log.w(TAG, e.getMessage());
    }

    Bundle args = new Bundle();
    args.putString("link", HtmlFormUtils.getResponseUrl());
    args.putBoolean(PrivateMessageInboxFragment.showOutboundExtra, outbound);
    FragmentUtils.fragmentTransaction(sourceFragment.getActivity(), new PrivateMessageInboxFragment(), false,
            false, args);
}

From source file:pt.up.mobile.authenticator.Authenticator.java

@Override
public Bundle hasFeatures(AccountAuthenticatorResponse response, Account account, String[] features) {
    // This call is used to query whether the Authenticator supports
    // specific features. We don't expect to get called, so we always
    // return false (no) for any queries.
    Log.v(TAG, "hasFeatures()");
    final Bundle result = new Bundle();
    result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, false);
    return result;
}

From source file:com.krayzk9s.imgurholo.activities.ImgurLinkActivity.java

public void onGetObject(Object o, String tag) {
    if (destroyed)
        return;/*from   w w  w  .  j  a v a 2  s . com*/
    if (tag.equals(IMAGE)) {
        try {
            JSONObject singleImageData = (JSONObject) o;
            Log.d("data", singleImageData.toString());
            SingleImageFragment singleImageFragment = new SingleImageFragment();
            Bundle bundle = new Bundle();
            bundle.putBoolean("gallery", true);
            JSONParcelable data = new JSONParcelable();
            data.setJSONObject(singleImageData.getJSONObject("data"));
            bundle.putParcelable("imageData", data);
            singleImageFragment.setArguments(bundle);
            FragmentManager fragmentManager = getSupportFragmentManager();
            FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
            fragmentTransaction.replace(R.id.frame_layout, singleImageFragment).commitAllowingStateLoss();
        } catch (JSONException e) {
            Log.e("Error!", e.toString());
        }
    } else if (tag.equals(ALBUM)) {
        try {
            JSONObject albumData = (JSONObject) o;
            Log.d("data", albumData.toString());
            ImagesFragment fragment = new ImagesFragment();
            Bundle bundle = new Bundle();
            bundle.putString("imageCall", "/3/album/" + album);
            bundle.putString("id", album);
            JSONParcelable data = new JSONParcelable();
            data.setJSONObject(albumData.getJSONObject("data"));
            bundle.putParcelable("albumData", data);
            fragment.setArguments(bundle);
            FragmentManager fragmentManager = getSupportFragmentManager();
            FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
            fragmentTransaction.replace(R.id.frame_layout, fragment).commitAllowingStateLoss();
        } catch (JSONException e) {
            Log.e("Error!", e.toString());
        }
    }
}

From source file:am.roadpolice.roadpolice.ViolationInfoActivity.java

@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

    // Get selected Violation Info Item.
    ViolationInfo violationInfo = (ViolationInfo) parent.getItemAtPosition(position);
    // Create a Bundle object to pass some data to Dialog Action.
    Bundle bundle = new Bundle();
    bundle.putBoolean(ActionDialogFragment.EXTRA_IS_PAYED, violationInfo.isPayed());
    bundle.putString(ActionDialogFragment.EXTRA_PIN, violationInfo.getPin());

    ActionDialogFragment dialog = (ActionDialogFragment) getSupportFragmentManager()
            .findFragmentByTag("action_dialog");
    if (dialog == null)
        dialog = new ActionDialogFragment();

    dialog.setCancelable(false);//from w ww.  j  a v  a2s  . c  om
    dialog.setArguments(bundle);
    // Start showing progress dialog fragment.
    FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    transaction.add(dialog, "action_dialog");
    transaction.commitAllowingStateLoss();
}

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

@SmallTest
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);//from   ww  w  . ja  v  a  2 s.co  m

    assertEquals(true, json.getBoolean("boolValue"));
    assertEquals(7, json.getInt("intValue"));
    assertEquals(5000000000l, json.getLong("longValue"));
    assertEquals(3.14, json.getDouble("doubleValue"));
    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"));
    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:com.nextgis.metroaccess.MetaDownloader.java

@Override
protected void onPostExecute(Void unused) {
    super.onPostExecute(unused);

    DismissDowloadDialog();/*from  w  ww .j a v a 2 s  .  c o  m*/

    if (msError != null) {
        if (moEventReceiver != null) {
            Bundle bundle = new Bundle();
            bundle.putBoolean(BUNDLE_ERRORMARK_KEY, true);
            bundle.putString(BUNDLE_MSG_KEY, msError);
            bundle.putInt(BUNDLE_EVENTSRC_KEY, 1);

            Message oMsg = new Message();
            oMsg.setData(bundle);
            moEventReceiver.sendMessage(oMsg);
        }
    }
}

From source file:com.nextgis.uikobserver.HttpSendData.java

@Override
protected void onPostExecute(Void unused) {
    super.onPostExecute(unused);
    if (mbShowProgress) {
        mDownloadDialog.dismiss();/*from   ww  w .  j a  va2  s .  c om*/
    }
    if (mError != null) {
        Bundle bundle = new Bundle();
        bundle.putBoolean("error", true);
        bundle.putString("err_msq", mError);
        bundle.putInt("src", mnType);

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