Example usage for android.os Bundle putString

List of usage examples for android.os Bundle putString

Introduction

In this page you can find the example usage for android.os Bundle putString.

Prototype

public void putString(@Nullable String key, @Nullable String value) 

Source Link

Document

Inserts a String value into the mapping of this Bundle, replacing any existing value for the given key.

Usage

From source file:de.elanev.studip.android.app.frontend.forums.ForumEntryFragment.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (isAdded()) {
        switch (item.getItemId()) {
        case android.R.id.home:
            getActivity().onBackPressed();

            return true;
        case R.id.forum_area_add:
            Bundle args = new Bundle();
            args.putString(ForumEntry.ID, mEntryId);
            args.putSerializable(ForumEntryComposeFragment.ENTRY_TYPE,
                    ForumEntryComposeFragment.EntryType.REPLY_ENTRY);

            Intent intent = new Intent(getActivity(), ForumEntryComposeActivity.class);
            intent.putExtras(args);/*from www  . j  a va2  s  . c o  m*/
            startActivityForResult(intent, CREATE_ENTRY);

            return true;
        default:
            return super.onOptionsItemSelected(item);
        }
    }
    return true;
}

From source file:com.clover.android.sdk.examples.AppNotificationTestActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putString(KEY_LOG, logText.getText().toString());
}

From source file:com.google.android.apps.muzei.api.Artwork.java

/**
 * Serializes this artwork object to a {@link Bundle} representation.
 *//* w w  w .  j  a  v a 2  s. com*/
public Bundle toBundle() {
    Bundle bundle = new Bundle();
    bundle.putString(KEY_IMAGE_URI, (mImageUri != null) ? mImageUri.toString() : null);
    bundle.putString(KEY_TITLE, mTitle);
    bundle.putString(KEY_BYLINE, mByline);
    bundle.putString(KEY_TOKEN, mToken);
    bundle.putString(KEY_VIEW_INTENT,
            (mViewIntent != null) ? mViewIntent.toUri(Intent.URI_INTENT_SCHEME) : null);
    return bundle;
}

From source file:com.QuarkLabs.BTCeClient.fragments.OrdersBookFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mPairsSpinner = (Spinner) LayoutInflater.from(getActivity()).inflate(R.layout.spinner, null);
    mPairsSpinner.setAdapter(new ArrayAdapter<>(getActivity(), android.R.layout.simple_list_item_1,
            getResources().getStringArray(R.array.ExchangePairs)));
    //restoring spinner position
    if (savedInstanceState != null) {
        mPairsSpinner.setSelection(savedInstanceState.getInt("position"));
    }//from w  ww. ja v  a2 s .  c  om
    mPairsSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            String selected = parent.getSelectedItem().toString();
            Bundle bundle = new Bundle();
            bundle.putString("pair", selected);
            if (mFragmentOpenedFirstTime) {
                getLoaderManager().initLoader(LOADER_ID, bundle, OrdersBookFragment.this);
                mFragmentOpenedFirstTime = false;
            } else {
                getLoaderManager().restartLoader(LOADER_ID, bundle, OrdersBookFragment.this);
            }
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {

        }
    });

    mAsksAdapter = new OrdersBookAdapter(getActivity());
    mBidsAdapter = new OrdersBookAdapter(getActivity());
}

From source file:edu.missouri.bas.bluetooth.equivital.EquivitalRunnable.java

private void updateSummary(String motion, String bodyPosition, double beltSensorRate, double ecgDerivedRate,
        double impedanceRate, double ecgRate, double beltQuality, double ecgQuality, double impedanceQuality,
        double heartRateConfidence, double breathingRateConfidence, double GSR) {
    // TODO Auto-generated method stub
    String dataFromChestSensor = motion + "," + bodyPosition + "," + String.valueOf(beltSensorRate) + ","
            + String.valueOf(ecgDerivedRate) + "," + String.valueOf(impedanceRate) + ","
            + String.valueOf(ecgRate) + "," + String.valueOf(beltQuality) + "," + String.valueOf(ecgQuality)
            + "," + String.valueOf(impedanceQuality) + "," + String.valueOf(heartRateConfidence) + ","
            + String.valueOf(breathingRateConfidence) + "," + String.valueOf(GSR);
    Message msgData = new Message();
    msgData.what = CHEST_SENSOR_DATA;//w  ww. j a va  2s  .  c  om
    Bundle dataBundle = new Bundle();
    dataBundle.putString("DATA", dataFromChestSensor);
    msgData.obj = dataBundle;
    chestSensorDataHandler.sendMessage(msgData);
}

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

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

    DismissDowloadDialog();/*from   w ww.j a v a2s.co 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.facebook.login.LoginLogger.java

public void logAuthorizationMethodComplete(String authId, String method, String result, String errorMessage,
        String errorCode, Map<String, String> loggingExtras) {

    Bundle bundle;
    bundle = LoginLogger.newAuthorizationLoggingBundle(authId);
    if (result != null) {
        bundle.putString(LoginLogger.EVENT_PARAM_LOGIN_RESULT, result);
    }/* w w  w  .  j  a v  a 2 s . c  om*/
    if (errorMessage != null) {
        bundle.putString(LoginLogger.EVENT_PARAM_ERROR_MESSAGE, errorMessage);
    }
    if (errorCode != null) {
        bundle.putString(LoginLogger.EVENT_PARAM_ERROR_CODE, errorCode);
    }
    if (loggingExtras != null && !loggingExtras.isEmpty()) {
        JSONObject jsonObject = new JSONObject(loggingExtras);
        bundle.putString(LoginLogger.EVENT_PARAM_EXTRAS, jsonObject.toString());
    }
    bundle.putString(EVENT_PARAM_METHOD, method);

    appEventsLogger.logSdkEvent(EVENT_NAME_LOGIN_METHOD_COMPLETE, null, bundle);
}

From source file:net.idlesoft.android.apps.github.activities.NewsFeed.java

@Override
public void onSaveInstanceState(final Bundle savedInstanceState) {
    if (mJson != null) {
        savedInstanceState.putString("json", mJson.toString());
    }//from  w  w w  . ja  v  a 2  s.  c  o m
    super.onSaveInstanceState(savedInstanceState);
}

From source file:eu.masconsult.bgbanking.accounts.AccountAuthenticator.java

@Override
public Bundle getAuthToken(AccountAuthenticatorResponse response, Account account, String authTokenType,
        Bundle options) throws NetworkErrorException {
    Log.v(TAG, "getAuthToken(account: " + account + ", authTokenType: " + authTokenType + ")");

    Bank bank = Bank.fromAccountType(context, account.type);
    if (bank == null) {
        throw new IllegalArgumentException("unsupported account type " + account.type);
    }/* w w w.java 2  s.  c  o  m*/
    if (!Constants.getAuthorityType(context).equals(authTokenType)) {
        throw new IllegalArgumentException("unsupported authTOkenType " + authTokenType);
    }

    final Intent intent = new Intent(context, LoginActivity.class);
    intent.putExtra(KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response);
    intent.putExtra(KEY_ACCOUNT_NAME, account.name);
    intent.putExtra(KEY_ACCOUNT_TYPE, account.type);

    String password = accountManager.getPassword(account);
    try {
        String authToken = bank.getClient().authenticate(account.name, password);
        Log.v(TAG, "obtained auth token " + authToken);

        if (authToken == null) {
            throw new AuthenticationException("no authToken");
        }

        // store the new auth token and return it
        accountManager.setAuthToken(account, authTokenType, authToken);
        intent.putExtra(KEY_AUTHTOKEN, authToken);
        return intent.getExtras();
    } catch (ParseException e) {
        Log.w(TAG, "ParseException", e);
        Bundle bundle = new Bundle();
        bundle.putInt(KEY_ERROR_CODE, 1);
        bundle.putString(KEY_ERROR_MESSAGE, e.getMessage());
        return bundle;
    } catch (IOException e) {
        Log.w(TAG, "IOException", e);
        throw new NetworkErrorException(e);
    } catch (CaptchaException e) {
        Log.w(TAG, "CaptchaException", e);
        // We need human to verify captcha
        final Bundle bundle = new Bundle();
        bundle.putParcelable(AccountManager.KEY_INTENT, intent);
        intent.putExtra(KEY_CAPTCHA_URI, e.getCaptchaUri());
        return bundle;
    } catch (AuthenticationException e) {
        Log.w(TAG, "AuthenticationException", e);
        // we need new credentials
        final Bundle bundle = new Bundle();
        bundle.putParcelable(AccountManager.KEY_INTENT, intent);
        return bundle;
    }
}

From source file:com.appnexus.opensdk.mediatedviews.GooglePlayDFPBanner.java

private PublisherAdRequest buildRequest(DFBBannerSSParameters ssparm, TargetingParameters targetingParameters) {
    PublisherAdRequest.Builder builder = new PublisherAdRequest.Builder();
    if ((ssparm.test_device != null) && (ssparm.test_device.length() > 0)) {
        adListener.printToClog("test device " + ssparm.test_device);
        builder.addTestDevice(ssparm.test_device);
    }//from  w  ww. j av  a2  s . c o  m

    switch (targetingParameters.getGender()) {
    case UNKNOWN:
        builder.setGender(PublisherAdRequest.GENDER_UNKNOWN);
        break;
    case FEMALE:
        builder.setGender(PublisherAdRequest.GENDER_FEMALE);
        break;
    case MALE:
        builder.setGender(PublisherAdRequest.GENDER_MALE);
        break;
    }

    Bundle bundle = new Bundle();

    if (targetingParameters.getAge() != null) {
        bundle.putString("Age", targetingParameters.getAge());
    }
    if (targetingParameters.getLocation() != null) {
        builder.setLocation(targetingParameters.getLocation());
    }
    for (Pair<String, String> p : targetingParameters.getCustomKeywords()) {
        bundle.putString(p.first, p.second);
    }

    builder.addNetworkExtras(new AdMobExtras(bundle));

    return builder.build();
}