Example usage for android.os Bundle putInt

List of usage examples for android.os Bundle putInt

Introduction

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

Prototype

public void putInt(@Nullable String key, int value) 

Source Link

Document

Inserts an int value into the mapping of this Bundle, replacing any existing value for the given key.

Usage

From source file:com.github.rutvijkumar.twittfuse.fragments.SearchTweetsFragment.java

public static SearchTweetsFragment newInstance(int page, String title, String query) {
    SearchTweetsFragment fragment = new SearchTweetsFragment();
    Bundle args = new Bundle();
    args.putInt("page", page);
    args.putString("title", title);
    args.putString("query", query);
    fragment.setArguments(args);/*from   w ww  .  j  ava2s  .  c o m*/
    return fragment;
}

From source file:com.skubit.bitid.fragments.SignInResponseFragment.java

public static SignInResponseFragment newInstance(int resultCode, String message) {
    SignInResponseFragment signInResponseFragment = new SignInResponseFragment();
    Bundle bundle = new Bundle();
    bundle.putInt("resultCode", resultCode);
    if (!TextUtils.isEmpty(message)) {
        bundle.putString("message", message);
    }/*w  ww  .  j  a va 2s.  com*/

    signInResponseFragment.setArguments(bundle);
    return signInResponseFragment;
}

From source file:Main.java

/**
 * Create a Parcelable Bundle containing 3 parameters: String, int, int for transport from the test package engine.<br>
 * It will be used by {@link Message#setData(Bundle)} for sending a part of whole message from engine.<br>
 * The String message is stored via Bundle.putCharArray using {@link #BUNDLE_SMALL_PARCEL_ID} as the key for the item.<br> 
 * The int message is stored via Bundle.putCharArray using {@link #BUNDLE_SMALL_PARCEL_INDEX} as the key for the item.<br>
 * The int message is stored via Bundle.putCharArray using {@link #BUNDLE_SMALL_PARCEL_TOTALNUMBER} as the key for the item.<br> 
 * /*www  .j av  a 2 s  .  c o m*/
 * @param ID String, the message's ID.
 * @param index int, the index of this parcel of the whole message.
 * @param totalNumber int, indicate the total number of parcels will be sent for a whole message..
 * @return Parcelable Bundle
 * @see Bundle#putCharArray(String, char[])
 * @see Bundle#getCharArray(String)
 * @see #getParcelableIDFromSmallParcel(Parcelable)
 * @see #getParcelableIndexFromSmallParcel(Parcelable)
 * @see #getParcelableTotalNumberFromSmallParcel(Parcelable)
 * @see #isSmallParcelOfWholeMessage(Bundle)
 */
public static Bundle setBundleOfSmallParcel(String ID, int index, int totalNumber) {
    Bundle bundle = new Bundle();
    bundle.putString(BUNDLE_SMALL_PARCEL_ID, ID);
    bundle.putInt(BUNDLE_SMALL_PARCEL_INDEX, index);
    bundle.putInt(BUNDLE_SMALL_PARCEL_TOTALNUMBER, totalNumber);
    bundle.setClassLoader(Bundle.class.getClassLoader());
    return bundle;
}

From source file:com.github.rutvijkumar.twittfuse.fragments.DirectMessagesFragments.java

public static DirectMessagesFragments newInstance(int page, String title) {
    DirectMessagesFragments fragment = new DirectMessagesFragments();
    Bundle args = new Bundle();
    args.putInt("page", page);
    args.putString("title", title);
    fragment.setArguments(args);//from   w  w  w  .  j  a  v a  2  s .c o  m
    return fragment;
}

From source file:com.manning.androidhacks.hack040.ImageDetailFragment.java

/**
 * Factory method to generate a new instance of the fragment given an image
 * number./*  w ww.  j a  v a  2s .  c  o  m*/
 * 
 * @param imageNum
 *          The image number within the parent adapter to load
 * @return A new instance of ImageDetailFragment with imageNum extras
 */
public static ImageDetailFragment newInstance(int imageNum) {
    final ImageDetailFragment f = new ImageDetailFragment();

    final Bundle args = new Bundle();
    args.putInt(IMAGE_DATA_EXTRA, imageNum);
    f.setArguments(args);

    return f;
}

From source file:com.tedx.logics.AttendeeLogic.java

public static Bundle GetCurrentDancers(Resources res, String EventUniqueId) {
    String Action = "GetAttendeeByUniqueId";

    JSONObject requestJSONParameters = new JSONObject();
    try {//from  w w  w .  ja v  a 2  s  .  c  o m
        requestJSONParameters.put("EventId", Integer.valueOf(res.getString(R.string.eventId)));
        requestJSONParameters.put("EventUniqueId", EventUniqueId);
    } catch (JSONException e) {
        // TODO Auto-generated catch block
        return null;
    }

    String URL = res.getString(R.string.WebServiceAddress) + Action;

    JSONObject responseJSON = WebServices.SendHttpPost(URL, requestJSONParameters);

    if (responseJSON != null) {
        try {
            if (responseJSON.getBoolean("IsSuccessful")) {
                Bundle ret = new Bundle();
                ret.putInt("AttendeeId", responseJSON.getInt("AttendeeId"));
                ret.putString("FirstName", responseJSON.getString("FirstName"));
                ret.putString("LastName", responseJSON.getString("LastName"));
                ret.putString("ContactNumber", responseJSON.getString("ContactNumber"));
                ret.putString("Website", responseJSON.getString("Website"));
                ret.putString("Email", responseJSON.getString("Email"));
                ret.putString("Facebook", responseJSON.getString("Facebook"));
                ret.putString("Twitter", responseJSON.getString("Twitter"));
                ret.putString("Description", responseJSON.getString("Description"));

                return ret;
            } else
                return null;
        } catch (JSONException e) {
            // TODO Auto-generated catch block
            return null;
        }
    } else
        return null;
}

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);
    fragment.setArguments(args);/*from  ww  w  .j  av a  2 s.  c  o m*/
    sContext = context;
    return fragment;
}

From source file:Main.java

public static Bundle bundleCalendar(Calendar cal) {
    Bundle args = new Bundle();
    if (cal == null)
        cal = Calendar.getInstance(Locale.getDefault());
    ;//from   w w  w.  ja v a  2 s .c  o m
    args.putInt("year", cal.get(Calendar.YEAR));
    args.putInt("month", cal.get(Calendar.MONTH));
    args.putInt("day", cal.get(Calendar.DAY_OF_MONTH));
    args.putInt("hour", cal.get(Calendar.HOUR_OF_DAY));
    args.putInt("minute", cal.get(Calendar.MINUTE));
    return args;
}

From source file:Main.java

public static Bundle bundleCalendar(Calendar cal, long minDate) {
    Bundle args = new Bundle();
    if (cal == null)
        cal = Calendar.getInstance(Locale.getDefault());
    ;//  ww w  . j  a  v  a 2 s  .c  om
    args.putInt("year", cal.get(Calendar.YEAR));
    args.putInt("month", cal.get(Calendar.MONTH));
    args.putInt("day", cal.get(Calendar.DAY_OF_MONTH));
    args.putInt("hour", cal.get(Calendar.HOUR_OF_DAY));
    args.putInt("minute", cal.get(Calendar.MINUTE));
    args.putLong("minDate", minDate);
    return args;
}

From source file:com.clockworkmod.billing.BillingReceiver.java

static Bundle makeRequestBundle(Context context, String method) {
    Bundle request = new Bundle();
    request.putString(Consts.BILLING_REQUEST_METHOD, method);
    request.putInt(Consts.BILLING_REQUEST_API_VERSION, 1);
    request.putString(Consts.BILLING_REQUEST_PACKAGE_NAME, context.getPackageName());
    return request;
}