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:org.androidtitlan.estoesgoogle.service.SyncService.java

@Override
protected void onHandleIntent(Intent intent) {
    Log.d(TAG, "onHandleIntent(intent=" + intent.toString() + ")");

    final ResultReceiver receiver = intent.getParcelableExtra(EXTRA_STATUS_RECEIVER);
    if (receiver != null)
        receiver.send(STATUS_RUNNING, Bundle.EMPTY);
    final SharedPreferences prefs = getSharedPreferences(Prefs.IOSCHED_SYNC, Context.MODE_PRIVATE);

    try {/*from  w w  w.  j a v  a2 s. c o  m*/
        // Bulk of sync work, performed by executing several fetches from
        // local sources.

        // Load static local data
        mLocalExecutor.execute(R.xml.blocks, new LocalBlocksHandler());
        mLocalExecutor.execute(R.xml.speakers, new LocalSpeakersHandler());
        mLocalExecutor.execute(R.xml.rooms, new LocalRoomsHandler());
        mLocalExecutor.execute(R.xml.tracks, new LocalTracksHandler());
        mLocalExecutor.execute(R.xml.search_suggest, new LocalSearchSuggestHandler());
        mLocalExecutor.execute(R.xml.sessions, new LocalSessionsHandler());

        // Save local parsed version
        prefs.edit().putInt(Prefs.LOCAL_VERSION, VERSION_CURRENT).commit();

    } catch (Exception e) {
        Log.e(TAG, "Problem while syncing", e);

        if (receiver != null) {
            // Pass back error to surface listener
            final Bundle bundle = new Bundle();
            bundle.putString(Intent.EXTRA_TEXT, e.toString());
            receiver.send(STATUS_ERROR, bundle);
        }
    }

    // Announce success to any surface listener
    Log.d(TAG, "sync finished");
    if (receiver != null)
        receiver.send(STATUS_FINISHED, Bundle.EMPTY);
}

From source file:com.ryan.ryanreader.activities.CommentReplyActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putString("comment_text", textEdit.getText().toString());
    outState.putString("parentIdAndType", parentIdAndType);
}

From source file:fr.cph.chicago.core.activity.BusBoundActivity.java

@Override
public void onSaveInstanceState(final Bundle savedInstanceState) {
    savedInstanceState.putString(bundleBusRouteId, busRouteId);
    savedInstanceState.putString(bundleBusRouteName, busRouteName);
    savedInstanceState.putString(bundleBusBound, bound);
    savedInstanceState.putString(bundleBusBoundTitle, boundTitle);
    super.onSaveInstanceState(savedInstanceState);
}

From source file:com.eTilbudsavis.sdkdemo.Search.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    outState.putSerializable(ARG_OFFERS, (Serializable) mOffers);
    outState.putString(ARG_QUERY, mQuery.getText().toString());
}

From source file:com.kevelbreh.steamchat.activity.AuthenticationActivity.java

/**
 * Authenticate the user.  Perform actions depending on the required form state and result code
 * of the Steam API.//from  w w  w.  j a v a 2s.  c  om
 */
@OnClick(R.id.authenticate)
public void authenticate() {
    if (isValid())
        try {
            Bundle data = new Bundle();
            data.putString("username", getUsername());
            data.putString("password", getPassword());
            data.putString("guard", getGuard());
            data.putString("machine", getMachine());

            Message message = Message.obtain(null, SteamService.EVENT_STEAM_USER_LOGIN);
            message.setData(data);
            mService.send(message);
        } catch (RemoteException e) {
            SteamChat.debug(this, e.getMessage(), e);
        }
}

From source file:com.openerp.services.UserGroupsSyncService.java

/**
 * Perform sync./*from   w ww.  j a  v  a  2s .c  o  m*/
 * 
 * @param context
 *            the context
 * @param account
 *            the account
 * @param extras
 *            the extras
 * @param authority
 *            the authority
 * @param provider
 *            the provider
 * @param syncResult
 *            the sync result
 */
public void performSync(Context context, Account account, Bundle extras, String authority,
        ContentProviderClient provider, SyncResult syncResult) {
    // TODO Auto-generated method stub
    try {
        UserGroupsDb usergroups = new UserGroupsDb(context);
        Intent intent = new Intent();
        intent.setAction(SyncFinishReceiver.SYNC_FINISH);
        if (OpenERPServerConnection.isNetworkAvailable(context)) {
            Log.i(TAG + "::performSync()", "Sync with Server Started");
            OEHelper oe = usergroups.getOEInstance();
            if (oe.syncWithServer(usergroups, null, false, false)) {
                MailFollowerDb group_follower = new MailFollowerDb(context);
                OEHelper oe_1 = group_follower.getOEInstance();
                JSONObject domain = new JSONObject();
                int partner_id = Integer.parseInt(OpenERPAccountManager.currentUser(context).getPartner_id());
                domain.accumulate("domain", new JSONArray("[[\"partner_id\", \"=\", " + partner_id
                        + "],[\"res_model\",\"=\", \"" + usergroups.getModelName() + "\"]]"));

                if (oe_1.syncWithServer(group_follower, domain, false, false)) {
                    Log.i(TAG, "UserGroups Sync Finished");
                    MailFollowerDb follower = new MailFollowerDb(context);
                    List<HashMap<String, Object>> user_groups = follower.executeSQL(follower.getModelName(),
                            new String[] { "res_id" },
                            new String[] { "partner_id = ?", "AND", "res_model = ?" },
                            new String[] { partner_id + "", "mail.group" });
                    JSONArray group_ids = new JSONArray();
                    if (user_groups.size() > 0) {
                        for (HashMap<String, Object> row : user_groups) {
                            group_ids.put(Integer.parseInt(row.get("res_id").toString()));
                        }
                    }
                    context.sendBroadcast(intent);
                    Bundle bundle = new Bundle();
                    bundle.putString("group_ids", group_ids.toString());
                    bundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
                    bundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
                    ContentResolver.requestSync(account, MessageProvider.AUTHORITY, bundle);
                }

            }

        } else {
            Log.e("OpenERPServerConnection", "Unable to Connect with server");
        }

    } catch (Exception e) {
        e.printStackTrace();
    }

}

From source file:com.facebook.login.LoginLogger.java

public void logCompleteLogin(String loginRequestId, Map<String, String> loggingExtras,
        LoginClient.Result.Code result, Map<String, String> resultExtras, Exception exception) {

    Bundle bundle = newAuthorizationLoggingBundle(loginRequestId);
    if (result != null) {
        bundle.putString(EVENT_PARAM_LOGIN_RESULT, result.getLoggingValue());
    }/*from  w w w .  ja va  2  s  . c  o m*/
    if (exception != null && exception.getMessage() != null) {
        bundle.putString(EVENT_PARAM_ERROR_MESSAGE, exception.getMessage());
    }

    // Combine extras from the request and from the result.
    JSONObject jsonObject = null;
    if (loggingExtras.isEmpty() == false) {
        jsonObject = new JSONObject(loggingExtras);
    }
    if (resultExtras != null) {
        if (jsonObject == null) {
            jsonObject = new JSONObject();
        }
        try {
            for (Map.Entry<String, String> entry : resultExtras.entrySet()) {
                jsonObject.put(entry.getKey(), entry.getValue());
            }
        } catch (JSONException e) {
        }
    }
    if (jsonObject != null) {
        bundle.putString(EVENT_PARAM_EXTRAS, jsonObject.toString());
    }

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

From source file:com.tweetlanes.android.core.view.DirectMessageFeedFragment.java

public static DirectMessageFeedFragment newInstance(int laneIndex, final TwitterContentHandleBase handleBase,
        final String screenName, final String userName, final String laneIdentifier, final Long otherUserId,
        final String currentAccountKey, final String cachedMessages) {

    DirectMessageFeedFragment fragment = new DirectMessageFeedFragment();

    fragment.mContentHandle = TwitterManager.get().getContentHandle(handleBase, screenName, laneIdentifier,
            currentAccountKey);//  w ww  .j a  v a  2  s.c o m

    fragment.configureBaseLaneFragment(laneIndex, fragment.mContentHandle.getTypeAsString(),
            new ConfigureBundleListener() {

                @Override
                public void addValues(Bundle args) {
                    // TODO: serializing is a slow way of doing this...
                    args.putSerializable("handleBase", handleBase);
                    args.putString("screenName", screenName);
                    args.putString("userName", userName);
                    args.putString("laneIdentifier", laneIdentifier);
                    if (otherUserId != null) {
                        args.putLong("otherUserId", otherUserId);
                    }
                    if (cachedMessages != null) {
                        args.putString("cachedMessages", cachedMessages);
                    }
                }

            });

    return fragment;
}

From source file:de.lebenshilfe_muenster.uk_gebaerden_muensterland.sign_browser.search.SignSearchActivity.java

@Override
public void onSaveInstanceState(Bundle outState) {
    Log.d(TAG, "onSaveInstanceState() " + this.hashCode());
    super.onSaveInstanceState(outState);
    outState.putString(QUERY, this.query);
}

From source file:gov.in.bloomington.georeporter.fragments.ReportFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putString("service", mService.toString());
}