Example usage for android.os Bundle Bundle

List of usage examples for android.os Bundle Bundle

Introduction

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

Prototype

public Bundle() 

Source Link

Document

Constructs a new, empty Bundle.

Usage

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

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

    try {/*from w  w w.j a v a2  s. com*/
        // 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:it.gulch.linuxday.android.fragments.EventDetailsFragment.java

public static EventDetailsFragment newInstance(Event event) {
    EventDetailsFragment f = new EventDetailsFragment();
    Bundle args = new Bundle();
    args.putSerializable(ARG_EVENT, event);
    f.setArguments(args);/*from w w  w  . ja  v a2  s  . c o m*/
    return f;
}

From source file:org.ale.scanner.zotero.web.worldcat.WorldCatAPIClient.java

public void isbnLookup(String isbn) {
    APIRequest r = newRequest();// w w  w .j  a  va 2s  . c  o m
    r.setHttpMethod(APIRequest.GET);
    r.setURI(URI.create(String.format(XISBN_SEARCH, isbn)));
    Bundle extra = new Bundle();
    extra.putString(WorldCatAPIClient.EXTRA_ISBN, isbn);
    r.setExtra(extra);

    mRequestQueue.enqueue(r);
}

From source file:com.ronnyml.sweetplayer.fragments.ExploreFragment.java

public static ExploreFragment newInstance(int position, String screen) {
    ExploreFragment fragment = new ExploreFragment();
    Bundle args = new Bundle();
    args.putInt(Constants.POSITION, position);
    args.putString(Constants.SCREEN, screen);
    fragment.setArguments(args);/*from   w ww  .ja  va2 s  .com*/
    return fragment;
}

From source file:com.amazon.adobepass.auth.AdobeAuthenticationActivity.java

/**
 * {@inheritDoc}// w ww. j  a v  a  2s.c o m
 * Method to get authentication token for the device.
 * The method retries on its own to take care of failed calls, caller does not need to retry.
 */
@Override
public void getAuthenticationToken() {

    try {
        getSubmitButton().setEnabled(false);
        if (NetworkUtils.isConnectedToNetwork(this)) {

            AdobepassRestClient.getAuthenticationTokenRequest(this, new JsonHttpResponseHandler() {

                @Override
                public void onSuccess(int statusCode, Header[] headers, JSONObject response) {

                    super.onSuccess(statusCode, headers, response);
                    Log.i(TAG, "getAuthenticationTokenRequest succeeded");
                    getSubmitButton().setEnabled(true);
                    try {
                        String mvpd = response.getString(AuthenticationConstants.MVPD);
                        Log.d(TAG, "Logged in with the following provider: " + mvpd);
                        Intent intent = new Intent();
                        Bundle bundle = new Bundle();
                        bundle.putString(AuthenticationConstants.MVPD, mvpd);
                        setResult(RESULT_OK, intent.putExtra(AuthenticationConstants.MVPD_BUNDLE, bundle));
                    } catch (Exception e) {
                        Log.e(TAG, "There was an exception when getting mvpd name.", e);
                        setResult(RESULT_OK);
                    }

                    finish();
                }

                @Override
                public void onFailure(int statusCode, Header[] headers, Throwable throwable,
                        JSONObject errorResponse) {

                    super.onFailure(statusCode, headers, throwable, errorResponse);
                    Log.e(TAG, "There was an error authenticating the user on second " + "screen. Status code: "
                            + statusCode + " Error: " + errorResponse, throwable);
                    getSubmitButton().setEnabled(true);
                    setResultAndReturn(throwable, AuthenticationConstants.AUTHENTICATION_ERROR_CATEGORY);
                }
            });
        } else {
            getSubmitButton().setEnabled(true);
            setResultAndReturn(null, AuthenticationConstants.NETWORK_ERROR_CATEGORY);
        }
    } catch (Exception e) {
        Log.e(TAG, "There was an exception when requesting the authentication token. ", e);
        getSubmitButton().setEnabled(true);
    }

}

From source file:com.clearcenter.mobile_demo.mdAuthenticator.java

public Bundle confirmCredentials(AccountAuthenticatorResponse response, Account account, Bundle options) {
    Log.v(TAG, "confirmCredentials()");
    //return null;
    final Intent intent = new Intent(ctx, mdAuthenticatorActivity.class);
    intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response);
    final Bundle bundle = new Bundle();
    bundle.putParcelable(AccountManager.KEY_INTENT, intent);
    return bundle;
}

From source file:org.andrico.andrico.UiHandler.java

void executeMethodForMessage(FBMethod m, int messageCode, WriteToProgressHandler progressHandler) {
    HttpResponse response = null;//  ww  w. jav  a 2s. co m
    try {
        //TODO: mFACEBOOK = NULL!!!!

        response = mFacebook.execute(m, progressHandler);
    } catch (NullPointerException e) {
        // We don't care if we get a npe. the npe will be handled by the handler.
    } finally {
        Bundle bundle = new Bundle();
        bundle.putString("result", HttpResponseRunnable.httpResponseToString(response));
        Message msg = obtainMessage(messageCode);
        msg.setData(bundle);
        sendMessage(msg);
    }
}

From source file:de.lebenshilfe_muenster.uk_gebaerden_muensterland.sign_browser.search.video.SignSearchVideoActivity.java

@NonNull
private SignVideoFragment setupSignVideoFragment() {
    final Parcelable parcelledSign = getParcelable();
    final SignVideoFragment signVideoFragment = new SignVideoFragment();
    final Bundle args = new Bundle();
    args.putParcelable(SignVideoFragment.SIGN_TO_SHOW, parcelledSign);
    signVideoFragment.setArguments(args);
    return signVideoFragment;
}

From source file:com.renren.api.connect.android.Util.java

/**
 * &?URL???key-value?/*from   w  ww  .j  ava2 s.c o  m*/
 * 
 * @param s
 * @return
 */
public static Bundle decodeUrl(String s) {
    Bundle params = new Bundle();
    if (s != null) {
        params.putString("url", s);
        String array[] = s.split("&");
        for (String parameter : array) {
            String v[] = parameter.split("=");
            if (v.length > 1) {
                params.putString(v[0], URLDecoder.decode(v[1]));
            }
        }
    }
    return params;
}