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.firebase.ui.auth.provider.FacebookProvider.java

@Override
public void onError(FacebookException error) {
    Bundle extra = new Bundle();
    extra.putString(ERROR, "error");
    extra.putString(ERROR_MSG, error.getMessage());
    mCallbackObject.onFailure(extra);//from ww  w .j  a  va 2s  . c  om
}

From source file:com.firebase.ui.auth.provider.FacebookProvider.java

private IDPResponse createIDPResponse(LoginResult loginResult, String email) {
    Bundle response = new Bundle();
    response.putString(ACCESS_TOKEN, loginResult.getAccessToken().getToken());
    return new IDPResponse(FacebookAuthProvider.PROVIDER_ID, email, response);
}

From source file:com.rampgreen.caretakermobile.GcmIntentService.java

private void sendNotification(String notificationTitle, String msg) {
    mNotificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);

    Bundle bundle = new Bundle();
    bundle.putString(Constants.NOTIFICATION_MSG, msg);
    bundle.putString(Constants.CALLED_COMPONENT, Constants.SERVICE_GCM_INTENT);

    Intent notificationIntent = new Intent(this, ActivityNotification.class);
    notificationIntent.putExtras(bundle);
    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);

    PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);

    NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this)
            .setSmallIcon(R.drawable.ic_launcher).setContentTitle(notificationTitle)
            .setStyle(new NotificationCompat.BigTextStyle().bigText(msg)).setContentText(msg);

    mBuilder.setContentIntent(contentIntent);
    Notification notification = mBuilder.build();
    notification.flags |= Notification.FLAG_AUTO_CANCEL;
    mNotificationManager.notify(NOTIFICATION_ID, notification);
}

From source file:com.appdynamics.demo.gasp.fragment.TwitterResponderFragment.java

private void setTweets() {
    TwitterStreamActivity activity = (TwitterStreamActivity) getActivity();

    try {/*from   w  w w  .j av  a  2s. co  m*/
        // Get Twitter search keyword from Shared Preferences
        SharedPreferences gaspSharedPreferences = PreferenceManager.getDefaultSharedPreferences(getActivity());
        String keyword = gaspSharedPreferences.getString(getString(R.string.gasp_twitter_preferences), "");

        if (mTweets == null) {
            Intent intent = new Intent(activity, RESTIntentService.class);
            intent.setData(Uri.parse(TwitterAPI.getTwitterApiSearch()));

            Bundle params = new Bundle();
            params.putString("q", keyword);
            params.putString("count", "10");

            Bundle headers = new Bundle();
            headers.putString("Authorization", "Bearer " + TwitterStreamActivity.getTwitterOAuthToken());

            intent.putExtra(RESTIntentService.EXTRA_PARAMS, params);
            intent.putExtra(RESTIntentService.EXTRA_HEADERS, headers);
            intent.putExtra(RESTIntentService.EXTRA_RESULT_RECEIVER, getResultReceiver());

            activity.startService(intent);
        } else if (activity != null) {
            ArrayAdapter<String> adapter = activity.getArrayAdapter();

            adapter.clear();
            for (String tweet : mTweets) {
                adapter.add(tweet);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.cloudbees.gasp.fragment.TwitterResponderFragment.java

private void setTweets() {
    TwitterStreamActivity activity = (TwitterStreamActivity) getActivity();

    try {//from w w w  . ja v a  2s.  c  o  m
        // Get Twitter search keyword from Shared Preferences
        SharedPreferences gaspSharedPreferences = PreferenceManager.getDefaultSharedPreferences(getActivity());
        String keyword = gaspSharedPreferences.getString(getString(R.string.gasp_twitter_preferences), "");

        if (mTweets == null && activity != null) {
            Intent intent = new Intent(activity, RESTIntentService.class);
            intent.setData(Uri.parse(TwitterAPI.getTwitterApiSearch()));

            Bundle params = new Bundle();
            params.putString("q", keyword);
            params.putString("count", "10");

            Bundle headers = new Bundle();
            headers.putString("Authorization", "Bearer " + TwitterStreamActivity.getTwitterOAuthToken());

            intent.putExtra(RESTIntentService.EXTRA_PARAMS, params);
            intent.putExtra(RESTIntentService.EXTRA_HEADERS, headers);
            intent.putExtra(RESTIntentService.EXTRA_RESULT_RECEIVER, getResultReceiver());

            activity.startService(intent);
        } else if (activity != null) {
            ArrayAdapter<String> adapter = activity.getArrayAdapter();

            adapter.clear();
            for (String tweet : mTweets) {
                adapter.add(tweet);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:cn.count.easydrive366.CarRegistrationEditActivity.java

@Override
public void processMessage(int msgType, final Object result) {

    super.processMessage(msgType, result);
    Bundle bundle = new Bundle();
    bundle.putString("result", result.toString());
    Intent intent = new Intent();
    intent.putExtras(bundle);//  ww w  . ja  v  a  2s .com
    setResult(RESULT_OK, intent);
    finish();
}

From source file:at.madexperts.logmynight.facebook.PublishHandler.java

/**
 * Called by the dispatcher to render the stream page.
 *//*from w  w w . ja  va  2  s  . co  m*/
public void go() {
    Facebook fb = Session.restore(getActivity()).getFb();
    AsyncFacebookRunner runner = new AsyncFacebookRunner(fb);
    Bundle params = new Bundle();
    String message = getActivity().getIntent().getStringExtra("message");

    params.putString("message", message);
    params.putString("link", "http://github.com/mikegr/alogmynight");
    params.putString("name", "Testname");
    params.putString("caption", "Test caption");
    params.putString("description", "<b>HTML Test for message</b>");

    runner.request("me/feed", params, "POST", new AsyncRequestListener() {

        public void onComplete(JSONObject obj) {
            String html;
            Log.d(TAG, "onComplete");
            getActivity().finish();
        }
    });

}

From source file:com.normalexception.app.rx8club.task.SubmitTask.java

@Override
protected void onPostExecute(Void result) {
    try {/*from   w ww  . ja v  a  2  s . co m*/
        mProgressDialog.dismiss();
        mProgressDialog = null;
    } catch (Exception e) {
        Log.w(TAG, e.getMessage());
    }

    final String respLink = HtmlFormUtils.getResponseUrl();
    Log.d(TAG, String.format("Setting Response In Bundle: %s", respLink));

    Bundle _args = new Bundle();
    _args.putString("link", respLink);
    _args.putString("page",
            pageNumber.equals("last") ? pageNumber : String.valueOf(Integer.parseInt(pageNumber)));
    _args.putString("title", pageTitle);

    Fragment _frag = ThreadFragment.newInstance();

    FragmentUtils.fragmentTransaction(sourceActivity.getActivity(), _frag, true, true, _args);
}

From source file:com.easy.facebook.android.apicall.FQL.java

public List<Friend> getFriends(String uids[]) throws EasyFacebookError {

    String whereClause = "";
    List<Friend> friendList = new ArrayList<Friend>();

    for (int i = 0; i < uids.length - 1; i++)
        whereClause = (new StringBuilder(String.valueOf(whereClause))).append("uid = ").append(uids[i])
                .append(" OR ").toString();

    whereClause = (new StringBuilder(String.valueOf(whereClause))).append("uid = ")
            .append(uids[uids.length - 1]).toString();

    Bundle params = new Bundle();
    params.putString("format", "json");
    params.putString("access_token", facebook.getAccessToken());
    params.putString("method", "fql.query");
    String fqlQuery = (new StringBuilder(
            "SELECT uid, name, pic, profile_update_time, timezone, birthday_date, status, online_presence, locale, profile_url, website, is_blocked FROM user WHERE "))
                    .append(whereClause).toString();
    params.putString("query", fqlQuery);

    String jsonResponse;// ww w .  ja  v  a2 s. c o  m
    try {
        jsonResponse = Util.openUrl("https://api.facebook.com/restserver.php", "POST", params);

        JSONObjectDecode jsonArray = new JSONObjectDecode(jsonResponse);
        for (int i = 0; i < jsonArray.length(); i++)
            friendList.add(jsonArray.getFriend(i));

    } catch (MalformedURLException e) {

        throw new EasyFacebookError(e.toString(), "MalformedURLException");
    } catch (IOException e) {

        throw new EasyFacebookError(e.toString(), "IOException");
    } catch (JSONException e) {

        throw new EasyFacebookError(e.toString(), "JSONException");
    }

    return friendList;

}

From source file:com.cloudbees.gasp.fragment.TwitterSearchResponderFragment.java

private void setTweets() {
    TwitterRESTServiceActivity activity = (TwitterRESTServiceActivity) getActivity();

    if (mTweets == null && activity != null) {
        // This is where we make our REST call to the service. We also pass in our ResultReceiver
        // defined in the RESTResponderFragment super class.

        // We will explicitly call our Service since we probably want to keep it as a private
        // component in our app. You could do this with Intent actions as well, but you have
        // to make sure you define your intent filters correctly in your manifest.
        Intent intent = new Intent(activity, RESTService.class);
        intent.setData(Uri.parse("http://search.twitter.com/search.json"));

        // Here we are going to place our REST call parameters. Note that
        // we could have just used Uri.Builder and appendQueryParameter()
        // here, but I wanted to illustrate how to use the Bundle params.
        Bundle params = new Bundle();
        params.putString("q", "cloudbees");

        intent.putExtra(RESTService.EXTRA_PARAMS, params);
        intent.putExtra(RESTService.EXTRA_RESULT_RECEIVER, getResultReceiver());

        // Here we send our Intent to our RESTService.
        activity.startService(intent);/*from w  w w.  j  a v  a 2s  . c o m*/
    } else if (activity != null) {
        // Here we check to see if our activity is null or not.
        // We only want to update our views if our activity exists.

        ArrayAdapter<String> adapter = activity.getArrayAdapter();

        // Load our list adapter with our Tweets.
        adapter.clear();
        for (String tweet : mTweets) {
            adapter.add(tweet);
        }
    }
}