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.ruesga.rview.fragments.EditorFragment.java

public static EditorFragment newInstance(int legacyChangeId, String changeId, String revisionId, String file,
        String content, boolean readOnly) {
    EditorFragment fragment = new EditorFragment();
    Bundle arguments = new Bundle();
    arguments.putInt(Constants.EXTRA_LEGACY_CHANGE_ID, legacyChangeId);
    arguments.putString(Constants.EXTRA_CHANGE_ID, changeId);
    arguments.putString(Constants.EXTRA_REVISION_ID, revisionId);
    if (!TextUtils.isEmpty(file)) {
        arguments.putString(Constants.EXTRA_FILE, file);
    }//from   w ww. j a v  a 2 s.  com
    if (!TextUtils.isEmpty(content)) {
        arguments.putString(Constants.EXTRA_CONTENT_FILE, content);
    }
    arguments.putBoolean(Constants.EXTRA_READ_ONLY, readOnly);
    fragment.setArguments(arguments);
    return fragment;
}

From source file:at.alladin.rmbt.android.fragments.result.QoSCategoryPagerFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putString(BUNDLE_QOS_RESULTS, results.getTestResultArray().toString());
    outState.putString(BUNDLE_DETAIL_TYPE, detailType.toString());
}

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

public void logAuthorizationMethodStart(String authId, String method) {
    Bundle bundle = LoginLogger.newAuthorizationLoggingBundle(authId);
    bundle.putString(EVENT_PARAM_METHOD, method);

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

From source file:br.ufsc.das.gtscted.shibbauth.SPSelectionActivity.java

/** Called when the activity is first created. */
@Override/*from  www  . j a va  2 s .c  o m*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.sp_selection);

    nextButton = (Button) findViewById(R.id.nextButton);
    exitButton = (Button) findViewById(R.id.exitButton);
    spEditText = (EditText) findViewById(R.id.spUrlEditText);

    //SP para testes   
    spEditText.setText("https://sp.ufrgs.br/chimarrao/");

    nextButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            String serviceUrl = spEditText.getText().toString();

            try {
                Connection connection = new Connection();
                String[] getResponseAndEndpoint = connection.httpGetWithEndpoint(serviceUrl);
                String wayfLocation = getResponseAndEndpoint[0];
                String responseBody = getResponseAndEndpoint[1];

                Bundle bundle = new Bundle();
                bundle.putString("html_source", responseBody);
                bundle.putString("wayf_location", wayfLocation);
                bundle.putSerializable("cookie", connection.getSerializableCookie(0));

                Intent newIntent = new Intent(SPSelectionActivity.this, ShibAuthenticationActivity.class);
                newIntent.putExtras(bundle);
                startActivity(newIntent);

            } catch (KeyManagementException e) {
                String message = "KeyManagementException";
                Toast toast = Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG);
                toast.show();
            } catch (NoSuchAlgorithmException e) {
                String message = "NoSuchAlgorithmException";
                Toast toast = Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG);
                toast.show();
            } catch (KeyStoreException e) {
                String message = "KeyStoreException";
                Toast toast = Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG);
                toast.show();
            } catch (UnrecoverableKeyException e) {
                String message = "UnrecoverableKeyException";
                Toast toast = Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG);
                toast.show();
            } catch (ClientProtocolException e) {
                String message = "ClientProtocolException";
                Toast toast = Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG);
                toast.show();
            } catch (IOException e) {
                String message = "IOException";
                Toast toast = Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG);
                toast.show();
            } catch (Exception e) {
                String message = "Exception";
                Toast toast = Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG);
                toast.show();
            }
        }
    });

    exitButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            finish();
        }
    });
}

From source file:com.groupme.sdk.util.HttpUtilsTest.java

public void testSetHttpParamsPost() {
    MockHttpClient client = new MockHttpClient();
    client.setContext(getContext());/*from   w  w w . jav a  2 s.co m*/
    String response = null;

    try {
        Bundle params = new Bundle();
        params.putString("group", "mygroup");
        params.putString("format", "json");

        response = HttpUtils.openUrl(client, OK_REQUEST, HttpUtils.METHOD_POST, null, params, null);
    } catch (HttpResponseException e) {
        fail("Received a response exception: " + e.toString());
    }

    try {
        HttpPost request = (HttpPost) client.getRequest();
        InputStream in = request.getEntity().getContent();
        BufferedReader r = new BufferedReader(new InputStreamReader(in), 1000);
        StringBuilder sb = new StringBuilder();

        for (String line = r.readLine(); line != null; line = r.readLine()) {
            sb.append(line);
        }

        assertTrue(!sb.toString().equals(""));

        Bundle bodyParams = HttpUtils.decodeParams(sb.toString());
        assertEquals("mygroup", bodyParams.getString("group"));
        assertEquals("json", bodyParams.getString("format"));
    } catch (IOException e) {
        fail("Error reading post body: " + e.toString());
    }

    if (response == null) {
        fail("Unexpected empty response");
    }
}

From source file:com.perm.DoomPlay.LyricsDialog.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    if (lyrics != null)
        outState.putString("keyLyrics", lyrics);
}

From source file:com.ztspeech.simutalk2.weibo.PostRecordTask.java

protected Integer doInBackground(Object... params) {
    /*//from ww w  . ja  va  2s. c  o  m
     * if (params == null || params.length == 0 || params.length != 5) {
     * handler.sendEmptyMessage(Constant.RESULT_FAILED_ARG_ERR); return 0; }
     */

    Kaixin kaixin = (Kaixin) params[0];
    handler = (Handler) params[1];
    String content = (String) params[2];
    InputStream in = (InputStream) params[3];
    try {
        // 
        Bundle bundle = new Bundle();
        bundle.putString("content", content);

        Map<String, Object> photoes = new HashMap<String, Object>();
        photoes.put("filename", in);

        String jsonResult = kaixin.uploadContent(context, RESTAPI_INTERFACE_POSTRECORD, bundle, photoes);

        if (jsonResult == null) {
            handler.sendEmptyMessage(Constant.RESULT_FAILED_NETWORK_ERR);
        } else {
            KaixinError kaixinError = Util.parseRequestError(jsonResult);
            if (kaixinError != null) {
                Message msg = Message.obtain();
                msg.what = Constant.RESULT_FAILED_REQUEST_ERR;
                msg.obj = kaixinError;
                handler.sendMessage(msg);
            } else {
                long rid = getRecordID(jsonResult);
                if (!isCancel) {
                    if (rid > 0) {
                        handler.sendEmptyMessage(Constant.RESULT_POST_RECORD_OK);
                    } else {
                        handler.sendEmptyMessage(Constant.RESULT_POST_RECORD_FAILED);
                    }
                } else {
                    handler.sendEmptyMessage(Constant.RESULT_USER_CANCEL_PROCESS);
                }
            }
        }
    } catch (MalformedURLException e1) {
        Log.e(TAG, "", e1);
        handler.sendEmptyMessage(Constant.RESULT_FAILED_MALFORMEDURL_ERR);
    } catch (IOException e1) {
        Log.e(TAG, "", e1);
        handler.sendEmptyMessage(Constant.RESULT_FAILED_NETWORK_ERR);
    } catch (Exception e1) {
        Log.e(TAG, "", e1);
        handler.sendEmptyMessage(Constant.RESULT_FAILED);
    }
    return 1;
}

From source file:at.bitfire.davdroid.mirakel.syncadapter.EnterCredentialsFragment.java

void queryServer() {
    FragmentTransaction ft = getFragmentManager().beginTransaction();

    Bundle args = new Bundle();

    String host_path = editBaseURL.getText().toString();
    args.putString(QueryServerDialogFragment.EXTRA_BASE_URL, URIUtils.sanitize(protocol + host_path));
    args.putString(QueryServerDialogFragment.EXTRA_USER_NAME, editUserName.getText().toString());
    args.putString(QueryServerDialogFragment.EXTRA_PASSWORD, editPassword.getText().toString());
    args.putBoolean(QueryServerDialogFragment.EXTRA_AUTH_PREEMPTIVE, checkboxPreemptive.isChecked());

    DialogFragment dialog = new QueryServerDialogFragment();
    dialog.setArguments(args);//from  w  ww. j  a  v a2s  . co  m
    dialog.show(ft, QueryServerDialogFragment.class.getName());
}

From source file:com.fanfou.app.opensource.update.AppVersionInfo.java

@Override
public void writeToParcel(final Parcel dest, final int flags) {
    final Bundle bundle = new Bundle();
    bundle.putInt("versionCode", this.versionCode);
    bundle.putString("versionName", this.versionName);
    bundle.putString("releaseDate", this.releaseDate);
    bundle.putString("changelog", this.changelog);
    bundle.putString("downloadUrl", this.downloadUrl);
    bundle.putString("versionType", this.versionType);
    bundle.putString("packageName", this.packageName);
    bundle.putBoolean("forceUpdate", this.forceUpdate);
    dest.writeBundle(bundle);/*w w  w  .j a v  a2s  . c o m*/
}

From source file:mobisocial.musubi.social.FacebookFriendFetcher.java

public JSONArray getFriendInfo() throws Exception {
    try {//  www  .j a  v  a 2s  .  com
        // Ask for friend information as FQL
        // This query gets the user id, full name, and small profile picture
        // of all of the logged-in user's friends (and the user himself)
        if (mFacebook.isSessionValid()) {
            Bundle params = new Bundle();
            params.putString("q", "SELECT uid, name, pic_square FROM user "
                    + "WHERE uid = me() OR uid in (SELECT uid2 FROM friend WHERE uid1 = me())");
            JSONObject data = Util.parseJson(mFacebook.request("fql", params));
            if (DBG)
                Log.d(TAG, data.toString());
            return data.getJSONArray("data");
        }
    } catch (FacebookError e) {
        Log.e(TAG, "Facebook request error", e);
    }
    return null;
}