Example usage for android.os Bundle getInt

List of usage examples for android.os Bundle getInt

Introduction

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

Prototype

public int getInt(String key) 

Source Link

Document

Returns the value associated with the given key, or 0 if no mapping of the desired type exists for the given key.

Usage

From source file:com.manning.androidhacks.hack047.fragments.ColorFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final Bundle bundle = getArguments();
    if (bundle != null) {
        mColor = bundle.getInt(COLOR_KEY);
        mText = bundle.getString(TEXT_KEY);
    }//  ww  w.ja  v  a  2  s. c  om
}

From source file:MainActivity.java

@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);
    mCounter = savedInstanceState.getInt(KEY_COUNTER);
}

From source file:com.manning.androidhacks.hack029.fragment.ColorFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Bundle bundle = getArguments();// ww w .j a v  a  2s .c  o  m
    if (getArguments() != null) {
        mColor = bundle.getInt(COLOR_KEY);
        mText = bundle.getString(TEXT_KEY);
        mIsLandscape = bundle.getBoolean(LANDSCAPE_KEY);
    }
}

From source file:com.fanfou.app.opensource.update.AppVersionInfo.java

public void readFromBundle(final Bundle bundle) {
    this.versionCode = bundle.getInt("versionCode");
    this.versionName = bundle.getString("versionName");
    this.releaseDate = bundle.getString("releaseDate");
    this.changelog = bundle.getString("changelog");
    this.downloadUrl = bundle.getString("downloadUrl");
    this.versionType = bundle.getString("versionType");
    this.packageName = bundle.getString("packageName");
    this.forceUpdate = bundle.getBoolean("forceUpdate");
}

From source file:am.roadpolice.roadpolice.dialogs.DialogConfirmation.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    // Get arguments which were sent by calling activity.
    Bundle bundle = getArguments();
    int titleResId = bundle.getInt(EXTRA_TITLE);
    int messageResId = bundle.getInt(EXTRA_MESSAGE);
    int positiveResId = bundle.getInt(EXTRA_POSITIVE);
    int negativeResId = bundle.getInt(EXTRA_NEGATIVE);
    int neutralResId = bundle.getInt(EXTRA_NEUTRAL);

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()).setTitle(titleResId)
            .setMessage(messageResId);/*from  www.ja v  a 2  s.  c o  m*/

    if (positiveResId != 0) {
        builder.setPositiveButton(positiveResId, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                if (mListener != null)
                    mListener.confirmationResult(CONFIRMATION_YES);
            }
        });
    }
    if (negativeResId != 0) {
        builder.setNegativeButton(negativeResId, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                if (mListener != null) {
                    mListener.confirmationResult(CONFIRMATION_NO);
                }
            }
        });
    }
    if (neutralResId != 0) {
        builder.setNeutralButton(neutralResId, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                if (mListener != null) {
                    mListener.confirmationResult(CONFIRMATION_CANCEL);
                }
            }
        });
    }

    return builder.create();
}

From source file:com.example.app.ArticleFragment.java

@Override
public void onStart() {
    super.onStart();

    // During startup, check if there are arguments passed to the fragment.
    // onStart is a good place to do this because the layout has already been
    // applied to the fragment at this point so we can safely call the method
    // below that sets the article text.
    Bundle args = getArguments();
    if (args != null) {
        // Set article based on argument passed in
        updateArticleView(args.getInt(ARG_POSITION));
    } else if (mCurrentPosition != -1) {
        // Set article based on saved instance state defined during onCreateView
        updateArticleView(mCurrentPosition);
    }//from  w  w w  . java 2  s .  c  om
}

From source file:com.cbtec.eliademy.BillingPlugin.java

private void getPurchasedItems(CallbackContext callbackContext) {
    try {/*w ww.  j av  a2  s  . c  om*/
        JSONArray products = new JSONArray();

        Bundle ownedItems = Eliademy.sBillingService.getPurchases(3, Eliademy.sInstance.getPackageName(),
                "inapp", null);

        if (ownedItems.getInt("RESPONSE_CODE") == 0) {
            final ArrayList<String> items = ownedItems.getStringArrayList("INAPP_PURCHASE_ITEM_LIST");

            for (int i = 0; i < items.size(); i++) {
                products.put(items.get(i));
            }
        }

        callbackContext.success(products);
    } catch (RemoteException e) {
        callbackContext.error(e.getMessage());
    }
}

From source file:net.eledge.android.europeana.gui.dialog.NameInputDialog.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.resTitle = savedInstanceState.getInt(KEY_RESTITLE_INT);
    this.resText = savedInstanceState.getInt(KEY_RESTEXT_INT);
    this.resInput = savedInstanceState.getInt(KEY_RESINPUT_INT);
    this.resPositiveButton = savedInstanceState.getInt(KEY_RESPOSBUTTON_INT);
}

From source file:MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    if (savedInstanceState != null) {
        mCounter = savedInstanceState.getInt(KEY_COUNTER);
    }//www. j av a  2  s  .  c  o m
}

From source file:gxu.software_engineering.market.android.ui.EditUserInfoBoxFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Bundle args = getArguments();
    type = args.getInt(C.USER_INFO_MODIFY_TYPE);
    app = MarketApp.marketApp();//w  w w. jav a 2  s  .com
    switch (type) {
    case C.CONTACT:
        v = getActivity().getLayoutInflater().inflate(R.layout.edit_contact, null);
        break;
    default:
    case C.PASSWORD:
        v = getActivity().getLayoutInflater().inflate(R.layout.edit_password, null);
        break;
    }
    return new AlertDialog.Builder(getActivity(), android.R.style.Theme_Holo_Dialog).setView(v)
            .setTitle(R.string.edit_user_info)
            .setIcon(type == C.CONTACT ? R.drawable.hardware_phone : R.drawable.device_access_secure)
            .setNegativeButton(R.string.no, null).setPositiveButton(R.string.submit, this).create();
}