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:com.eutectoid.dosomething.picker.FriendPickerFragment.java

void saveSettingsToBundle(Bundle outState) {
    super.saveSettingsToBundle(outState);

    outState.putString(USER_ID_BUNDLE_KEY, userId);
    outState.putBoolean(MULTI_SELECT_BUNDLE_KEY, multiSelect);
}

From source file:com.autoparts.buyers.activity.InquiryModelActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    outState.putInt(STATE_URI, currentState);
    outState.putString(STATE_FRAGMENT_TAG, currentContentFragmentTag);

    super.onSaveInstanceState(outState);
}

From source file:mobisocial.musubi.webapp.WebAppActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putString(EXTRA_CURRENT_PAGE, mCurrentPage);
}

From source file:com.vuze.android.remote.AndroidUtils.java

public static boolean executeSearch(String search, Context context, SessionInfo sessionInfo) {
    Intent myIntent = new Intent(Intent.ACTION_SEARCH);
    myIntent.setClass(context, MetaSearch.class);
    RemoteProfile remoteProfile = sessionInfo.getRemoteProfile();
    if (remoteProfile != null && remoteProfile.getRemoteType() == RemoteProfile.TYPE_LOOKUP) {
        Bundle bundle = new Bundle();
        bundle.putString("com.vuze.android.remote.searchsource", sessionInfo.getRpcRoot());
        if (remoteProfile.getRemoteType() == RemoteProfile.TYPE_LOOKUP) {
            bundle.putString("com.vuze.android.remote.ac", remoteProfile.getAC());
        }//  ww  w .ja v  a2s.c  o  m
        bundle.putString(SessionInfoManager.BUNDLE_KEY, remoteProfile.getID());

        myIntent.putExtra(SearchManager.APP_DATA, bundle);
    }

    myIntent.putExtra(SearchManager.QUERY, search);

    context.startActivity(myIntent);
    return true;
}

From source file:com.facebook.unity.UnityParams.java

public Bundle getStringParams() {
    Bundle result = new Bundle();
    Iterator<?> keys = json.keys();
    while (keys.hasNext()) {
        String key = (String) keys.next();
        try {//from w ww .  ja  va 2 s.c  o  m
            String value = json.getString(key);
            if (value != null) {
                result.putString(key, value);
            }
        } catch (JSONException e) {
        }
    }
    return result;
}

From source file:at.wada811.android.library.demos.loader.LoaderListFragment.java

/**
 * URL???/*ww w  .  j av a 2 s . c o  m*/
 * 
 * @param url ?URL
 */
private void searchImageWithUrl(String url) {
    LogUtils.i(url);
    Loader<Object> currentLoader = getLoaderManager().getLoader(mLoaderListAdapter.getCount());
    if (currentLoader != null && currentLoader.isStarted()) {
        // ?
        LogUtils.i("canceled!");
        return;
    }
    Bundle args = new Bundle();
    args.putInt(LoaderListFragment.KEY_START_INDEX, mLoaderListAdapter.getCount());
    args.putString(LoaderListFragment.KEY_SEARCH_URL, url);
    getLoaderManager().restartLoader(mLoaderListAdapter.getCount(), args, new LoaderCallbacks<Void>() {
        @Override
        public Loader<Void> onCreateLoader(int id, Bundle args) {
            LogUtils.i("LoaderId: " + id);
            return new AsyncImageSearchLoader(getActivity(), args, new JsonHttpResponseHandler() {
                @Override
                public void onSuccess(int statusCode, JSONObject response) {
                    super.onSuccess(statusCode, response);
                    LogUtils.d("statusCode: " + statusCode);
                    try {
                        int responseStatus = response.getInt("responseStatus");
                        LogUtils.d("responseStatus: " + responseStatus);
                        if (responseStatus != 200) {
                            return;
                        }
                        JSONObject responseData = response.getJSONObject("responseData");
                        JSONArray results = responseData.getJSONArray("results");
                        ArrayList<LoaderListItem> resultsList = new ArrayList<LoaderListItem>(results.length());
                        for (int i = 0; i < results.length(); i++) {
                            JSONObject result = results.getJSONObject(i);
                            LoaderListItem item = new LoaderListItem();
                            item.setImageUrl(result.getString("unescapedUrl"));
                            item.setThumbnailUrl(result.getString("tbUrl"));
                            item.setImageTitle(result.getString("titleNoFormatting"));
                            item.setImageWidth(Integer.valueOf(result.getString("width")));
                            item.setImageHeight(Integer.valueOf(result.getString("height")));
                            resultsList.add(item);
                        }
                        if (mLoaderListAdapter.getCount() == 0) {
                            setListShown(true);
                        }
                        if (resultsList.size() > 0) {
                            mLoaderListAdapter.addAll(resultsList);
                            getListView().invalidateViews();
                        }
                    } catch (JSONException e) {
                        e.printStackTrace();
                        LogUtils.e(e);
                    }
                }

                @Override
                public void onFailure(int statusCode, Throwable e, JSONObject errorResponse) {
                    super.onFailure(statusCode, e, errorResponse);
                    LogUtils.e("statusCode: " + statusCode);
                    LogUtils.e(e);
                }
            });
        }

        @Override
        public void onLoadFinished(Loader<Void> loader, Void data) {
            LogUtils.i("LoaderId: " + loader.getId());
        }

        @Override
        public void onLoaderReset(Loader<Void> loader) {
            LogUtils.i();
        }
    });
}

From source file:com.facebook.AsyncRequestTests.java

@LargeTest
public void testBatchUploadPhoto() {
    final AccessToken accessToken = getAccessTokenForSharedUserWithPermissions(null, "user_photos",
            "publish_actions");

    final int image1Size = 120;
    final int image2Size = 150;

    Bitmap bitmap1 = createTestBitmap(image1Size);
    Bitmap bitmap2 = createTestBitmap(image2Size);

    Bundle parameters = new Bundle();
    parameters.putString("fields", "width");

    GraphRequest uploadRequest1 = GraphRequest.newUploadPhotoRequest(accessToken,
            ShareInternalUtility.MY_PHOTOS, bitmap1, null, null, null);
    uploadRequest1.setBatchEntryName("uploadRequest1");
    GraphRequest uploadRequest2 = GraphRequest.newUploadPhotoRequest(accessToken,
            ShareInternalUtility.MY_PHOTOS, bitmap2, null, null, null);
    uploadRequest2.setBatchEntryName("uploadRequest2");
    GraphRequest getRequest1 = new GraphRequest(accessToken, "{result=uploadRequest1:$.id}", parameters, null,
            new ExpectSuccessCallback() {
                @Override/*  w  w w.ja  v a  2  s.  c o m*/
                protected void performAsserts(GraphResponse response) {
                    assertNotNull(response);
                    JSONObject retrievedPhoto = response.getJSONObject();
                    assertNotNull(retrievedPhoto);
                    assertEquals(image1Size, retrievedPhoto.optInt("width"));
                }
            });
    GraphRequest getRequest2 = new GraphRequest(accessToken, "{result=uploadRequest2:$.id}", parameters, null,
            new ExpectSuccessCallback() {
                @Override
                protected void performAsserts(GraphResponse response) {
                    assertNotNull(response);
                    JSONObject retrievedPhoto = response.getJSONObject();
                    assertNotNull(retrievedPhoto);
                    assertEquals(image2Size, retrievedPhoto.optInt("width"));
                }
            });

    TestGraphRequestAsyncTask task = new TestGraphRequestAsyncTask(uploadRequest1, uploadRequest2, getRequest1,
            getRequest2);
    task.executeOnBlockerThread();

    // Wait on 3 signals: getRequest1, getRequest2, and task will all signal.
    waitAndAssertSuccess(3);
}

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

@Override
protected void onSaveInstanceState(final Bundle outState) {
    final TextView postTitle = (TextView) findViewById(R.id.tv_dashboard_latestPost_title);
    final TextView postLink = (TextView) findViewById(R.id.tv_dashboard_latestPost_link);

    outState.putString("postTitle", postTitle.getText().toString());
    outState.putString("postLink", postLink.getText().toString());

    super.onSaveInstanceState(outState);
}

From source file:com.facebook.android.Places.java

private void fetchPlaces() {
    if (!isFinishing()) {
        dialog = ProgressDialog.show(Places.this, "", getString(R.string.nearby_places), true, true,
                new DialogInterface.OnCancelListener() {
                    @Override/*from  w ww  . jav a2  s.c  om*/
                    public void onCancel(DialogInterface dialog) {
                        showToast("No places fetched.");
                    }
                });
    }
    /*
     * Source tag: fetch_places_tag
     */
    Bundle params = new Bundle();
    params.putString("type", "place");
    try {
        params.putString("center", location.getString("latitude") + "," + location.getString("longitude"));
    } catch (JSONException e) {
        showToast("No places fetched.");
        return;
    }
    params.putString("distance", "1000");
    Utility.mAsyncRunner.request("search", params, new placesRequestListener());
}

From source file:com.infine.android.devoxx.service.RestService.java

@Override
protected void onHandleIntent(Intent intent) {

    final ResultReceiver receiver = intent.getParcelableExtra(EXTRA_STATUS_RECEIVER);

    // si passage du numero de version
    // final int latestVersion = intent.getIntExtra(EXTRA_LASTEST_VERSION,
    // 1);/* www. j a  va2s.  c o m*/

    if (receiver != null)
        receiver.send(ServiceStatus.STATUS_RUNNING, Bundle.EMPTY);

    // final Context context = this;
    // final SharedPreferences prefs =
    // getSharedPreferences(Prefs.DEVOXX_SCHEDULE_SYNC,
    // Context.MODE_PRIVATE);
    // final int localVersion = prefs.getInt(Prefs.LOCAL_VERSION,
    // VERSION_NONE);

    try {

        // Bulk of sync work, performed by executing several fetches from
        // local and online sources.
        final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mApplicationContext);
        int scheduleVersion = prefs.getInt(PREFS_SCHEDULE_VERSION, -1);
        int sessionVersion = prefs.getInt(PREFS_SESSION_VERSION, -1);
        int speakerVersion = prefs.getInt(PREFS_SPEAKER_VERSION, -1);

        if (scheduleVersion + sessionVersion + speakerVersion < 0) {
            // on charge les fichiers statiques que la premiere fois
            // ou quand un jeu de donnes schedule ou session est pourri
            // verion = -1
            loadStaticFiles();
        }
        loadStaticRoom();

        // Always hit remote spreadsheet for any updates
        loadRemoteData();

    } 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
    if (receiver != null)
        receiver.send(STATUS_FINISHED, Bundle.EMPTY);
}