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.mikecorrigan.trainscorekeeper.FragmentHistory.java

public static FragmentHistory newInstance(int index, JSONObject jsonSpec) {
    Log.vc(VERBOSE, TAG, "newInstance: jsonTab=" + jsonSpec);

    FragmentHistory fragment = new FragmentHistory();
    Bundle args = new Bundle();
    args.putInt(ARG_INDEX, index);// w w  w  . j  a va 2  s .  c om
    args.putString(ARG_TAB_SPEC, jsonSpec.toString());
    fragment.setArguments(args);
    return fragment;
}

From source file:com.royclarkson.springagram.HomeFragment.java

public static HomeFragment newInstance(String apiUrl) {
    HomeFragment fragment = new HomeFragment();
    Bundle args = new Bundle();
    args.putString(ARG_API_URL, apiUrl);
    fragment.setArguments(args);/*from   w ww. j a  v  a  2s . c  o  m*/
    return fragment;
}

From source file:com.jrummyapps.busybox.dialogs.BusyBoxAppletDialog.java

public static void show(Activity activity, String applet, String help) {
    BusyBoxAppletDialog dialog = new BusyBoxAppletDialog();
    Bundle args = new Bundle();
    args.putString("applet_name", applet);
    args.putString("applet_help", help);
    dialog.setArguments(args);//w w  w. j  a v  a2 s.  c  o m
    dialog.show(activity.getFragmentManager(), "BusyBoxAppletDialog");
    Analytics.newEvent("applet help").put("applet", applet).log();
}

From source file:com.minihelper.logic.ClientApi.java

/**
 * add by zxy update at 2012-07-05 /* w  ww  .  jav a2 s  . co  m*/
 * */
public static JSONObject getAppUpdate() throws HttpRequstError, JSONException {
    JSONObject jsonobj = Util.httpGet(ApiConfig.AppUpdate, new Bundle());
    Log.i("app_msg", "" + jsonobj);
    if (!jsonobj.getBoolean("status")) {
        throw new HttpRequstError(jsonobj.getString("ErrorMessage"));
    }
    return jsonobj.getJSONObject("msg");
}

From source file:com.chess.genesis.data.GameDataDB.java

public static Bundle rowToBundle(final Cursor cursor, final int index, final boolean closeCursor) {
    final Bundle bundle = new Bundle();
    final String[] column = cursor.getColumnNames();

    cursor.moveToPosition(index);/*from   www. j a va 2 s . c  om*/
    for (int i = 0, len = cursor.getColumnCount(); i < len; i++)
        bundle.putString(column[i], cursor.getString(i));
    if (closeCursor)
        cursor.close();
    return bundle;
}

From source file:Main.java

/**
 * Create a account for the sync adapter.
 *
 * @param _context The application context.
 * @return the new created Account./*from  ww  w .j  av a  2  s .c  o  m*/
 */
public static Account createSyncAccount(Context _context, String _username) {
    // create a new a account.
    Account newAccount = new Account(_username, ACCOUNT_TYPE);

    AccountManager accountManager = (AccountManager) _context.getSystemService(Context.ACCOUNT_SERVICE);
    Account[] accounts = accountManager.getAccountsByType(ACCOUNT_TYPE);
    for (Account account : accounts) {
        if (account.equals(newAccount)) {
            // account already exists
            return null;
        }
    }

    // try to login and retrieve the token

    Bundle bundle = new Bundle();
    bundle.putString("Token", "some auth token please");

    if (accountManager.addAccountExplicitly(newAccount, null, bundle)) {

    } else {
        Log.i(TAG, "createSyncAccount: account already exists or an error happened");
    }

    return newAccount;
}

From source file:Main.java

/**
 * Get activity meta-data.//  w w  w . j  a  va2  s.c o m
 * @param activity activity to get meta-data from.
 * @return meta-data, may be empty but never null.
 */
public static Bundle getActivityMetaData(Activity activity) {
    Bundle config;
    try {
        config = activity.getPackageManager().getActivityInfo(activity.getComponentName(),
                GET_META_DATA).metaData;
        if (config == null)
            config = new Bundle();
    } catch (Exception e) {
        /*
         * NameNotFoundException or in some rare scenario an undocumented "RuntimeException: Package
         * manager has died.", probably caused by a system app process crash.
         */
        config = new Bundle();
    }
    return config;
}

From source file:Main.java

/**
 * Get application meta-data of the current package name.
 * @param context application context./* w  ww. jav  a2 s  .com*/
 * @return meta-data, may be empty but never null.
 */
public static Bundle getMetaData(Context context) {
    Bundle config;
    try {
        config = context.getPackageManager().getApplicationInfo(context.getPackageName(),
                PackageManager.GET_META_DATA).metaData;
        if (config == null)
            config = new Bundle();
    } catch (Exception e) {
        /*
         * NameNotFoundException or in some rare scenario an undocumented "RuntimeException: Package
         * manager has died.", probably caused by a system app process crash.
         */
        config = new Bundle();
    }
    return config;
}

From source file:com.test.shopping.view.ProductDetailFragment.java

public static ProductDetailFragment create(Context context, int position) {
    ProductDetailFragment fragment = new ProductDetailFragment();
    Bundle args = new Bundle();
    args.putInt(ARG_PAGE, position);//w  ww.ja v  a  2s  .c o  m
    fragment.setArguments(args);
    sContext = context;
    return fragment;
}

From source file:com.royclarkson.springagram.GalleryAddFragment.java

public static GalleryAddFragment newInstance(String galleriesUrl) {
    GalleryAddFragment fragment = new GalleryAddFragment();
    Bundle args = new Bundle();
    args.putString(ARG_GALLERIES_LIST_URL, galleriesUrl);
    fragment.setArguments(args);/*from   ww  w. j  ava 2  s.co  m*/
    return fragment;
}