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:br.com.brolam.cloudvision.ui.NoteVisionActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putBoolean(USE_FLASH, this.useFlash);
    outState.putBoolean(ON_KEYBOARD, this.onKeyboard);
    outState.putString(NOTE_VISION_KEY, this.noteVisionKey);
    outState.putString(NOTE_VISION_ITEM_KEY, this.noteVisionItemKey);
    outState.putString(NoteVision.TITLE, editTextTitle.getText().toString());
    outState.putString(NoteVisionItem.CONTENT, editTextContent.getText().toString());
}

From source file:br.com.bioscada.apps.biotracks.TrackDetailActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putString(CURRENT_TAB_TAG_KEY, tabHost.getCurrentTabTag());
    if (photoUri != null) {
        outState.putParcelable(PHOTO_URI_KEY, photoUri);
    }//from w w  w.  j  av  a  2 s  .c o  m
    outState.putBoolean(HAS_PHOTO_KEY, hasPhoto);
}

From source file:com.amaze.filemanager.fragments.CompressedExplorerFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    outState.putParcelableArrayList(KEY_ELEMENTS, elements);
    outState.putString(KEY_PATH, relativeDirectory);
    outState.putString(KEY_URI, compressedFile.getPath());
    outState.putString(KEY_FILE, compressedFile.getPath());
    outState.putParcelableArrayList(KEY_CACHE_FILES, files);
    outState.putBoolean(KEY_OPEN, isOpen);
}

From source file:at.wada811.android.dialogfragments.AlertDialogFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putBoolean(IS_FROM_BUILDER, isFromBuilder);
}

From source file:com.anton.gavel.ComplaintSubmission.java

public void submit() {

    //Body of your click handler
    Thread trd = new Thread(new Runnable() {
        @Override/*from ww  w.  ja va  2  s . c  om*/
        public void run() {
            String formPath = "http://www.hamilton.ca/Hamilton.Portal/Templates/COHShell.aspx?NRMODE=Published&NRORIGINALURL=%2fCityDepartments%2fCorporateServices%2fITS%2fForms%2bin%2bDevelopment%2fMunicipal%2bLaw%2bEnforcement%2bOnline%2bComplaint%2bForm%2ehtm&NRNODEGUID=%7b4319AA7C-7E5E-4D65-9F46-CCBEC9AB86E0%7d&NRCACHEHINT=Guest";
            String hideString = "document.getElementById('mainform').style.display = 'none';";
            //this javascript will be added to the page if we are successful - we can look
            //for it to identify whether our form was successfully submitted

            // Create a new HttpClient and Post Header
            HttpClient httpClient = new DefaultHttpClient();

            ArrayList<NameValuePair> parameters = new ArrayList<NameValuePair>();

            for (String key : post_params.keySet()) {
                parameters.add(new BasicNameValuePair(key, post_params.get(key)));
                String value = post_params.get(key);
                if (value != null && value.length() > 0) {
                    value = value.substring(0, Math.min(70, value.length()));
                }
                Log.d("Runs", "key: '" + key + "', value: '" + value);
            }
            //convert to a list of name-value pairs (dum, dee dum  -  duuuuumm...)

            HttpPost request = new HttpPost(formPath);

            //set up handler/bundle to give output to main thread
            Handler handler = ((GavelMain) mContext).submissionHandler;
            Message msg = handler.obtainMessage();
            Bundle bundle = new Bundle();

            try {
                request.setEntity(new UrlEncodedFormEntity(parameters));

                HttpResponse httpResponse = httpClient.execute(request);
                HttpEntity responseEntity = httpResponse.getEntity();

                String response = responseEntity == null ? ""
                        : EntityUtils.toString(responseEntity, EntityUtils.getContentCharSet(responseEntity));
                //read the html page posted in response to our request

                appendLog(response); // logs html page response to a text file on sd card

                bundle.putBoolean("succeeded",
                        httpResponse.getStatusLine().getStatusCode() == 200 && response.contains(hideString));

                msg.setData(bundle);
                handler.sendMessage(msg);
            } catch (ClientProtocolException e) {
                bundle.putBoolean("succeeded", false);
                msg.setData(bundle);
                handler.sendMessage(msg);
            } catch (IOException e) {
                bundle.putBoolean("succeeded", false);
                msg.setData(bundle);
                handler.sendMessage(msg);
            } //code to do the HTTP request            
        }
    });
    trd.start();

    //

    return;

}

From source file:com.example.snapcacheexample.SelectionFragment.java

@Override
public void onSaveInstanceState(Bundle bundle) {
    super.onSaveInstanceState(bundle);
    for (BaseListElement listElement : listElements) {
        listElement.onSaveInstanceState(bundle);
    }/*from   ww w . j a  v  a 2s  .c o  m*/
    bundle.putBoolean(PENDING_ANNOUNCE_KEY, pendingAnnounce);
    uiHelper.onSaveInstanceState(bundle);
}

From source file:com.facebook.LegacyTokenHelper.java

private void deserializeKey(String key, Bundle bundle) throws JSONException {
    String jsonString = cache.getString(key, "{}");
    JSONObject json = new JSONObject(jsonString);

    String valueType = json.getString(JSON_VALUE_TYPE);

    if (valueType.equals(TYPE_BOOLEAN)) {
        bundle.putBoolean(key, json.getBoolean(JSON_VALUE));
    } else if (valueType.equals(TYPE_BOOLEAN_ARRAY)) {
        JSONArray jsonArray = json.getJSONArray(JSON_VALUE);
        boolean[] array = new boolean[jsonArray.length()];
        for (int i = 0; i < array.length; i++) {
            array[i] = jsonArray.getBoolean(i);
        }//from w w w .  ja va 2s  .c om
        bundle.putBooleanArray(key, array);
    } else if (valueType.equals(TYPE_BYTE)) {
        bundle.putByte(key, (byte) json.getInt(JSON_VALUE));
    } else if (valueType.equals(TYPE_BYTE_ARRAY)) {
        JSONArray jsonArray = json.getJSONArray(JSON_VALUE);
        byte[] array = new byte[jsonArray.length()];
        for (int i = 0; i < array.length; i++) {
            array[i] = (byte) jsonArray.getInt(i);
        }
        bundle.putByteArray(key, array);
    } else if (valueType.equals(TYPE_SHORT)) {
        bundle.putShort(key, (short) json.getInt(JSON_VALUE));
    } else if (valueType.equals(TYPE_SHORT_ARRAY)) {
        JSONArray jsonArray = json.getJSONArray(JSON_VALUE);
        short[] array = new short[jsonArray.length()];
        for (int i = 0; i < array.length; i++) {
            array[i] = (short) jsonArray.getInt(i);
        }
        bundle.putShortArray(key, array);
    } else if (valueType.equals(TYPE_INTEGER)) {
        bundle.putInt(key, json.getInt(JSON_VALUE));
    } else if (valueType.equals(TYPE_INTEGER_ARRAY)) {
        JSONArray jsonArray = json.getJSONArray(JSON_VALUE);
        int[] array = new int[jsonArray.length()];
        for (int i = 0; i < array.length; i++) {
            array[i] = jsonArray.getInt(i);
        }
        bundle.putIntArray(key, array);
    } else if (valueType.equals(TYPE_LONG)) {
        bundle.putLong(key, json.getLong(JSON_VALUE));
    } else if (valueType.equals(TYPE_LONG_ARRAY)) {
        JSONArray jsonArray = json.getJSONArray(JSON_VALUE);
        long[] array = new long[jsonArray.length()];
        for (int i = 0; i < array.length; i++) {
            array[i] = jsonArray.getLong(i);
        }
        bundle.putLongArray(key, array);
    } else if (valueType.equals(TYPE_FLOAT)) {
        bundle.putFloat(key, (float) json.getDouble(JSON_VALUE));
    } else if (valueType.equals(TYPE_FLOAT_ARRAY)) {
        JSONArray jsonArray = json.getJSONArray(JSON_VALUE);
        float[] array = new float[jsonArray.length()];
        for (int i = 0; i < array.length; i++) {
            array[i] = (float) jsonArray.getDouble(i);
        }
        bundle.putFloatArray(key, array);
    } else if (valueType.equals(TYPE_DOUBLE)) {
        bundle.putDouble(key, json.getDouble(JSON_VALUE));
    } else if (valueType.equals(TYPE_DOUBLE_ARRAY)) {
        JSONArray jsonArray = json.getJSONArray(JSON_VALUE);
        double[] array = new double[jsonArray.length()];
        for (int i = 0; i < array.length; i++) {
            array[i] = jsonArray.getDouble(i);
        }
        bundle.putDoubleArray(key, array);
    } else if (valueType.equals(TYPE_CHAR)) {
        String charString = json.getString(JSON_VALUE);
        if (charString != null && charString.length() == 1) {
            bundle.putChar(key, charString.charAt(0));
        }
    } else if (valueType.equals(TYPE_CHAR_ARRAY)) {
        JSONArray jsonArray = json.getJSONArray(JSON_VALUE);
        char[] array = new char[jsonArray.length()];
        for (int i = 0; i < array.length; i++) {
            String charString = jsonArray.getString(i);
            if (charString != null && charString.length() == 1) {
                array[i] = charString.charAt(0);
            }
        }
        bundle.putCharArray(key, array);
    } else if (valueType.equals(TYPE_STRING)) {
        bundle.putString(key, json.getString(JSON_VALUE));
    } else if (valueType.equals(TYPE_STRING_LIST)) {
        JSONArray jsonArray = json.getJSONArray(JSON_VALUE);
        int numStrings = jsonArray.length();
        ArrayList<String> stringList = new ArrayList<String>(numStrings);
        for (int i = 0; i < numStrings; i++) {
            Object jsonStringValue = jsonArray.get(i);
            stringList.add(i, jsonStringValue == JSONObject.NULL ? null : (String) jsonStringValue);
        }
        bundle.putStringArrayList(key, stringList);
    } else if (valueType.equals(TYPE_ENUM)) {
        try {
            String enumType = json.getString(JSON_VALUE_ENUM_TYPE);
            @SuppressWarnings({ "unchecked", "rawtypes" })
            Class<? extends Enum> enumClass = (Class<? extends Enum>) Class.forName(enumType);
            @SuppressWarnings("unchecked")
            Enum<?> enumValue = Enum.valueOf(enumClass, json.getString(JSON_VALUE));
            bundle.putSerializable(key, enumValue);
        } catch (ClassNotFoundException e) {
        } catch (IllegalArgumentException e) {
        }
    }
}

From source file:com.aniruddhc.acemusic.player.LauncherActivity.LauncherActivity.java

private void showTrialFragment(final boolean expired, int numDaysRemaining) {

    //Load the trial fragment into the activity.
    TrialFragment fragment = new TrialFragment();
    Bundle bundle = new Bundle();
    bundle.putInt("NUM_DAYS_REMAINING", numDaysRemaining);
    bundle.putBoolean("EXPIRED", expired);
    fragment.setArguments(bundle);//  w w  w. ja va 2  s . co  m

    FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    transaction.replace(R.id.launcher_root_view, fragment, "trialFragment");
    transaction.commit();

}

From source file:co.taqat.call.assistant.AssistantActivity.java

public void displayCreateAccount() {
    fragment = new CreateAccountFragment();
    Bundle extra = new Bundle();
    extra.putBoolean("LinkPhoneNumber", isLink);
    extra.putBoolean("LinkFromPref", fromPref);
    fragment.setArguments(extra);/*from  w  w w .j ava 2  s.c  o m*/
    changeFragment(fragment);
    currentFragment = AssistantFragmentsEnum.CREATE_ACCOUNT;
    back.setVisibility(View.VISIBLE);
}

From source file:ca.ualberta.cmput301w14t08.geochan.fragments.ThreadViewFragment.java

/**
 * Set up and launch the EditFragment for a given comment.
 * //from www  . ja va2 s. com
 * @param comment The Comment that is being edited.
 */
private void editComment(Comment comment) {
    Fragment fragment = new EditFragment();
    Bundle bundle = new Bundle();
    boolean fromFavs = false;
    bundle.putInt("threadIndex", threadIndex);
    bundle.putString("commentId", comment.getId());
    Fragment fav = getFragmentManager().findFragmentByTag("favThrFragment");
    if (fav != null) {
        fromFavs = true;
    }
    bundle.putBoolean("fromFavs", fromFavs);
    fragment.setArguments(bundle);
    getFragmentManager().beginTransaction().replace(container, fragment, "editFrag").addToBackStack(null)
            .commit();
    getFragmentManager().executePendingTransactions();
}