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.kennethmaffei.infinitegrid.HTTPCommManager.java

/**
 * Sets up a headless fragment that calls an asynctask to retrieve an image from a url
 * //from  ww w .  j  ava  2s. co  m
 * @param url - the url which we will get data back from
 */
public void getURL(RecordDescriptor record) {
    if (activity == null)
        return;

    FragmentManager fm = activity.getFragmentManager();
    //Use the url as the fragment tag
    TaskFragment taskFragment = (TaskFragment) fm.findFragmentByTag(record.url);

    //If the Fragment is non-null, then it is currently being retained across a configuration change.
    if (taskFragment == null) {
        taskFragment = new TaskFragment();
        Bundle args = new Bundle();
        args.putInt("type", CALLTYPE.IMAGE.ordinal());
        args.putParcelable("record", record);
        taskFragment.setArguments(args);
        fm.beginTransaction().add(taskFragment, record.url).commit();
    }
}

From source file:com.nokia.example.paymentoneapk.PaymentOneAPKActivity.java

private void mapProductsSkus() {

    productSkus.add("android.test.purchased");

    final Bundle productMappings = new Bundle();
    productMappings.putString("1023608", "android.test.purchased");

    try {/*w w w.j av  a2  s . co m*/
        mService.mapProducts(API_VERSION, getPackageName(), productMappings);
    } catch (final RemoteException e) {
        Log.e(TAG, "error while mapping product skus", e);
    }

}

From source file:com.facebook.AsyncRequestTests.java

@MediumTest
@LargeTest/* w  w w.j av  a2  s.c  om*/
public void testExecuteSingleGet() {
    final AccessToken accessToken = getAccessTokenForSharedUser();
    Bundle parameters = new Bundle();
    parameters.putString("fields", "location");
    GraphRequest request = new GraphRequest(accessToken, "TourEiffel", parameters, null,
            new ExpectSuccessCallback() {
                @Override
                protected void performAsserts(GraphResponse response) {
                    assertNotNull(response);
                    JSONObject graphPlace = response.getJSONObject();
                    assertEquals("Paris", graphPlace.optJSONObject("location").optString("city"));
                }
            });

    TestGraphRequestAsyncTask task = new TestGraphRequestAsyncTask(request);

    task.executeOnBlockerThread();

    // Wait on 2 signals: request and task will both signal.
    waitAndAssertSuccess(2);
}

From source file:com.facebook.RequestTests.java

@LargeTest
public void testExecuteSingleGet() {
    Bundle parameters = new Bundle();
    parameters.putString("fields", "location");

    GraphRequest request = new GraphRequest(AccessToken.getCurrentAccessToken(), "TourEiffel", parameters,
            null);/* w  w w. j  av a2s .c  o m*/
    GraphResponse response = request.executeAndWait();

    assertTrue(response != null);
    assertTrue(response.getError() == null);
    assertNotNull(response.getJSONObject());
    assertNotNull(response.getRawResponse());

    JSONObject graphPlace = response.getJSONObject();
    assertEquals("Paris", graphPlace.optJSONObject("location").optString("city"));
}

From source file:de.electricdynamite.pasty.PastyLoader.java

public PastyLoader(Context context, int taskId, Bundle args) {
    super(context);
    if (PastySharedStatics.LOCAL_LOG == true)
        this.LOCAL_LOG = true;
    if (args == null)
        args = new Bundle();
    this.context = context;
    // Restore preferences
    this.prefs = new PastyPreferencesProvider(context);
    // Create a PastyClient
    client = new PastyClient(prefs.getRESTBaseURL(), true);
    client.setUsername(prefs.getUsername());
    client.setPassword(prefs.getPassword());
    this.taskId = taskId;
    this.permitCache = args.getBoolean("permitCache", PastyLoader.CACHE_PERMITTED);
}

From source file:com.facebook.android.friendsmash.ScoreboardFragment.java

private void closeAndShowError(String error) {
    Bundle bundle = new Bundle();
    bundle.putString("error", error);

    Intent i = new Intent();
    i.putExtras(bundle);/*ww  w .j  a  v a2  s  .  c om*/

    getActivity().setResult(Activity.RESULT_CANCELED, i);
    getActivity().finish();
}

From source file:com.bodeme.easycloud.syncadapter.EnterCredentialsFragment.java

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

    Bundle args = new Bundle();

    String url;/*w w w . j  a  v  a 2 s.co m*/
    String username = editUserName.getText().toString();
    if (Constants.OWNCLOUD_URL == null) {
        url = editURL.getText().toString();
    } else {
        url = Constants.OWNCLOUD_URL;
    }

    if (url.charAt(url.length() - 1) != '/') {
        url = url + "/";
    }

    if (0 == typePosition) {
        url += "remote.php/caldav/principals/" + username + "/";
    } else {
        url += "remote.php/carddav/addressbooks/" + username + "/";
    }

    args.putString(QueryServerDialogFragment.EXTRA_BASE_URL, URIUtils.sanitize(url));
    args.putString(QueryServerDialogFragment.EXTRA_USER_NAME, username);
    args.putString(QueryServerDialogFragment.EXTRA_PASSWORD, editPassword.getText().toString());
    args.putBoolean(QueryServerDialogFragment.EXTRA_AUTH_PREEMPTIVE, true);

    DialogFragment dialog = new QueryServerDialogFragment();
    dialog.setArguments(args);
    dialog.show(ft, QueryServerDialogFragment.class.getName());
}

From source file:edu.mit.mobile.android.locast.sync.AbsLocastAccountSyncService.java

@Override
public int onStartCommand(Intent intent, int flags, int startId) {

    Bundle extras = intent.getExtras();//from  www . j  av  a2 s  .c  o  m
    if (extras == null) {
        extras = new Bundle();
    }
    extras.putString(EXTRA_SYNC_URI, intent.getData().toString());

    final Account account = extras.getParcelable(EXTRA_ACCOUNT);

    // TODO make this shortcut the Android sync system.
    ContentResolver.requestSync(account, getAuthority(), extras);

    return START_NOT_STICKY;
}

From source file:MyWeatherService.java

void sendWeatherToClient(String actualWeatherString) {
    Bundle reply = new Bundle();
    reply.putString("weather", actualWeatherString);
    Message replyMessage = Message.obtain();
    replyMessage.setData(reply);//from w ww. j a  v  a  2  s  . c  o m
    try {
        messengerToClient.send(replyMessage);
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}