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.hichinaschool.flashcards.anki.StudyOptionsActivity.java

public void loadContent(boolean onlyFnsMsg, Bundle cramConfig) {
    mCurrentFragment = StudyOptionsFragment.newInstance(0, false, null);
    Bundle args = getIntent().getExtras();
    if (onlyFnsMsg) {
        args.putBoolean("onlyFnsMsg", onlyFnsMsg);
    }/*www  . j a  va  2 s  . c o  m*/
    if (cramConfig != null) {
        args.putBundle("cramInitialConfig", cramConfig);
    }
    mCurrentFragment.setArguments(args);
    getSupportFragmentManager().beginTransaction().add(android.R.id.content, mCurrentFragment).commit();
}

From source file:es.uniovi.imovil.fcrtrainer.HexadecimalExerciseFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putBoolean("tohex", tohex);
    outState.putInt("numbertoconvert", numberToConvert);
}

From source file:net.reichholf.dreamdroid.fragment.ScreenShotFragment.java

private void shouldRetain(boolean retainInstance) {
    Bundle args = new Bundle();
    args.putBoolean(BUNDLE_KEY_RETAIN, retainInstance);
    setArguments(args);

}

From source file:android.support.v17.leanback.app.BrandedSupportFragment.java

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

From source file:com.googlecode.android_scripting.facade.CameraFacade.java

@Rpc(description = "Take a picture and save it to the specified path.", returns = "A map of Booleans autoFocus and takePicture where True "
        + "indicates success. cameraId also included.")
public Bundle cameraCapturePicture(@RpcParameter(name = "targetPath") final String targetPath,
        @RpcParameter(name = "useAutoFocus") @RpcDefault("true") Boolean useAutoFocus,
        @RpcParameter(name = "cameraId", description = "Id of camera to use. SDK 9") @RpcDefault("0") Integer cameraId)
        throws Exception {
    final BooleanResult autoFocusResult = new BooleanResult();
    final BooleanResult takePictureResult = new BooleanResult();
    Camera camera = openCamera(cameraId);
    if (camera == null) {
        String msg = String.format("can't initialize camera id %d, try to use another id", cameraId);
        Log.e(msg);/*from  ww  w  . ja v  a 2 s. c om*/

        Bundle result = new Bundle();
        result.putInt("cameraId", cameraId);
        result.putBoolean("autoFocus", false);
        result.putBoolean("takePicture", false);
        result.putString("reason", msg + ", see logcat for details");
        return result;
    }
    Parameters prm = camera.getParameters();
    camera.setParameters(prm);

    try {
        Method method = camera.getClass().getMethod("setDisplayOrientation", int.class);
        method.invoke(camera, 90);
    } catch (Exception e) {
        Log.e(e);
    }

    try {
        FutureActivityTask<SurfaceHolder> previewTask = setPreviewDisplay(camera);
        camera.startPreview();
        if (useAutoFocus) {
            autoFocus(autoFocusResult, camera);
        }
        takePicture(new File(targetPath), takePictureResult, camera);
        previewTask.finish();
    } catch (Exception e) {
        Log.e(e);
    } finally {
        camera.release();
    }

    Bundle result = new Bundle();
    result.putBoolean("autoFocus", autoFocusResult.mmResult);
    result.putBoolean("takePicture", takePictureResult.mmResult);
    result.putInt("cameraId", cameraId);
    return result;
}

From source file:com.dudka.rich.streamingmusicplayer.MainActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    if (isChangingConfigurations()) {
        outState.putBoolean(IS_CHANGING_CONFIGURATIONS, true);
    } else {/*from www. j  a va 2 s.c om*/
        outState.putBoolean(IS_CHANGING_CONFIGURATIONS, false);
    }
    outState.putBoolean("isPlaying", isPlaying);
    outState.putString("songName", songName);
    outState.putString("artistName", artistName);
    outState.putString("coverImage", coverImage);
}

From source file:com.nextgis.metroaccess.MetaDownloader.java

@Override
protected Void doInBackground(String... urls) {
    if (IsNetworkAvailible(moContext)) {
        try {/*from   w w w  .  ja v  a2  s.  c  o  m*/
            String sURL = urls[0];

            moHTTPGet = new HttpGet(sURL);

            Log.d(TAG, "HTTPGet URL " + sURL);

            HttpParams httpParameters = new BasicHttpParams();
            int timeoutConnection = 1500;
            HttpConnectionParams.setConnectionTimeout(httpParameters, timeoutConnection);
            // Set the default socket timeout (SO_TIMEOUT) 
            // in milliseconds which is the timeout for waiting for data.
            int timeoutSocket = 3000;
            HttpConnectionParams.setSoTimeout(httpParameters, timeoutSocket);

            HttpClient Client = new DefaultHttpClient(httpParameters);
            HttpResponse response = Client.execute(moHTTPGet);
            if (response == null)
                return null;
            HttpEntity entity = response.getEntity();

            if (moEventReceiver != null) {
                if (entity != null) {
                    Bundle bundle = new Bundle();
                    if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
                        bundle.putBoolean(BUNDLE_ERRORMARK_KEY, false);
                        msContent = EntityUtils.toString(entity, HTTP.UTF_8);
                        bundle.putString(BUNDLE_PAYLOAD_KEY, msContent);
                        bundle.putInt(BUNDLE_EVENTSRC_KEY, 1);
                    } else {
                        bundle.putBoolean(BUNDLE_ERRORMARK_KEY, true);
                        bundle.putString(BUNDLE_MSG_KEY, moContext.getString(R.string.sNetworkGetErr));
                        bundle.putInt(BUNDLE_EVENTSRC_KEY, 1);
                    }

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

                    moEventReceiver.sendMessage(oMsg);
                } else {
                    msError = moContext.getString(R.string.sNetworkUnreachErr);
                }
            }

        } catch (ClientProtocolException e) {
            msError = e.getMessage();
            //cancel(true);
        } catch (IOException e) {
            msError = e.getMessage();
            //cancel(true);
        }
    } else {
        if (moEventReceiver != null) {
            Bundle bundle = new Bundle();
            bundle.putBoolean(BUNDLE_ERRORMARK_KEY, true);
            bundle.putString(BUNDLE_MSG_KEY, moContext.getString(R.string.sNetworkUnreachErr));
            bundle.putInt(BUNDLE_EVENTSRC_KEY, 1);

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

From source file:cmput301.f13t01.editstory.EditStoryActivity.java

@Override
/**//from   w  w w .j a  va2 s  .  c  o m
 * Generate instance state
 */
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putBoolean(getResources().getString(R.string.story_is_new), isNew);
    outState.putSerializable(getResources().getString(R.string.story_id), storyId);
}

From source file:com.odoo.addons.customers.CustomerDetails.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putBoolean(KEY_MODE, mEditMode);
    outState.putString(KEY_NEW_IMAGE, newImage);
}

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

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putInt(CODE, mCodeView.getSelectedItemPosition());
    outState.putCharSequence(USER_COMMENT, mUserComment.getText());
    outState.putBoolean(USER_ON_VEHICLE, mUserOnVehicle.isChecked());
    outState.putCharSequence(USER_VEHICLE_NUM, mUserVehicle.getText());
}