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.sawyer.advadapters.app.adapters.jsonadapter.JSONAdapterFragment.java

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

    if (savedInstanceState != null) {
        mCheckedCount = savedInstanceState.getInt(STATE_CAB_CHECKED_COUNT);
        try {// w  w  w.j a va 2  s  . c  o  m
            JSONArray list = new JSONArray(savedInstanceState.getString(STATE_LIST));
            setListAdapter(new MovieJSONAdapter(getActivity(), list));
        } catch (JSONException e) {
            Log.e(JSONAdapterFragment.class.getSimpleName(), "OnRestore Error", e);
            mCheckedCount = 0;
            setListAdapter(new MovieJSONAdapter(getActivity()));
        }
    } else {
        setListAdapter(new MovieJSONAdapter(getActivity()));
    }
}

From source file:com.sawyer.advadapters.app.adapters.jsonadapter.UnitTestJSONArrayFragment.java

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

    if (savedInstanceState != null) {
        mCheckedCount = savedInstanceState.getInt(STATE_CAB_CHECKED_COUNT);
        try {//from  www .  ja v a  2  s. com
            JSONArray list = new JSONArray(savedInstanceState.getString(STATE_LIST));
            setListAdapter(new UnitTestMovieAdapter(getActivity(), list));
        } catch (JSONException e) {
            Log.w(UnitTestJSONArrayFragment.class.getSimpleName(), "Error restoring state", e);
            mCheckedCount = 0;
            setListAdapter(new UnitTestMovieAdapter(getActivity()));
        }
    } else {
        setListAdapter(new UnitTestMovieAdapter(getActivity()));
    }
}

From source file:it.scoppelletti.mobilepower.app.ProgressDialogFragment.java

/**
 * Crea il dialogo.//from ww w  .  j  a v a2s. co  m
 * 
 * @param  savedInstanceState Stato dell’istanza.
 * @return                    Dialogo.
 */
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    int max, resId;
    ProgressDialog dlg;
    Bundle args = getArguments();

    dlg = new ProgressDialog(getActivity(), AppUtils.getDialogTheme());

    resId = args.getInt(ProgressDialogFragment.ARG_TITLEID);
    dlg.setTitle(getString(resId));
    max = args.getInt(ProgressDialogFragment.ARG_MAX, -1);

    if (max > 0) {
        dlg.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
        dlg.setIndeterminate(false);
        dlg.setMax(max);
    } else {
        dlg.setIndeterminate(true);
        dlg.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    }

    dlg.setCancelable(args.getBoolean(ProgressDialogFragment.ARG_CANCELABLE));
    dlg.setCanceledOnTouchOutside(false);

    return dlg;
}

From source file:com.sawyer.advadapters.app.adapters.nfjsonadapter.NFJSONAdapterFragment.java

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

    if (savedInstanceState != null) {
        mCheckedCount = savedInstanceState.getInt(STATE_CAB_CHECKED_COUNT);
        try {/*from  w  ww. ja  v  a 2 s.c  om*/
            JSONArray list = new JSONArray(savedInstanceState.getString(STATE_LIST));
            setListAdapter(new MovieNFJSONArrayAdapter(getActivity(), list));
        } catch (JSONException e) {
            Log.e(NFJSONAdapterFragment.class.getSimpleName(), "OnRestore Error", e);
            mCheckedCount = 0;
            setListAdapter(new MovieNFJSONArrayAdapter(getActivity()));
        }
    } else {
        setListAdapter(new MovieNFJSONArrayAdapter(getActivity()));
    }
}

From source file:com.tangrainc.inappbilling.InAppBillingHelper.java

public ListenableFuture<JSONObject[]> getPurchases(final String continuationToken) {
    return _executor.submit(new Callable<JSONObject[]>() {
        @Override/*from w ww. j a  v a 2s  .  com*/
        public JSONObject[] call() throws Exception {
            Log.d(TAG, "Getting Purchases...");

            ArrayList<JSONObject> result = new ArrayList<>();
            Bundle ownedItems = _service.getPurchases(3, _context.getPackageName(), "inapp", continuationToken);
            int response = ownedItems.getInt("RESPONSE_CODE");

            if (response == 0) {
                ArrayList<String> purchaseDataList = ownedItems.getStringArrayList("INAPP_PURCHASE_DATA_LIST");
                ArrayList<String> signatureList = ownedItems.getStringArrayList("INAPP_DATA_SIGNATURE_LIST");
                String newContinuationToken = ownedItems.getString("INAPP_CONTINUATION_TOKEN");

                for (int i = 0; i < purchaseDataList.size(); i++) {
                    String purchaseData = purchaseDataList.get(i);
                    String signature = signatureList.get(i);
                    JSONObject resultItem = new JSONObject(purchaseData);

                    resultItem.put("signature", signature);
                    result.add(resultItem);
                }

                if (newContinuationToken != null) {
                    result.addAll(Arrays.asList(getPurchases(newContinuationToken).get()));
                }
            } else {
                throw new Exception("Response from service: " + response);
            }

            return result.toArray(new JSONObject[0]);
        }
    });
}

From source file:com.krayzk9s.imgurholo.ui.ImagePager.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (savedInstanceState != null) {
        imageData = savedInstanceState.getParcelableArrayList("imageData");
        start = savedInstanceState.getInt("start");
    } else {//  w  w w. ja va2 s .  c  o m
        Bundle bundle = getArguments();
        start = bundle.getInt("start");
        imageData = bundle.getParcelableArrayList("ids");
    }
}

From source file:com.mikecorrigan.trainscorekeeper.Players.java

public void restoreUi(Bundle bundle) {
    Log.vc(VERBOSE, TAG, "restoreUi: bundle=" + Utils.bundleToString(bundle));
    setSelection(bundle.getInt(BUNDLE_SELECTED_ID));
}

From source file:com.dev.pygmy.game.GameHomePageActivity.java

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

    getActionBar().setDisplayHomeAsUpEnabled(true);
    button = (Button) findViewById(R.id.play_downloadButton);
    mGame = new GameHolder();

    // Retrieve informations of the game selected
    Bundle extras = getIntent().getExtras();
    mGame.id = extras.getInt("id");
    mGame.name = extras.getString("gameName");
    mGame.summary = extras.getString("summary");
    mGame.filename = extras.getString("filename");
    mGame.version = extras.getString("version");
    mGame.image = extras.getString("image");
    mGame.minPlayers = extras.getInt("minPlayer");
    mGame.maxPlayers = extras.getInt("maxPlayer");

    new FetchUpdateTask().execute();
}

From source file:com.example.android.networkconnect.SimpleTextFragment.java

/**
 * Processes the arguments passed into this Fragment via setArguments method.
 * Currently the method only looks for text or a textID, nothing else.
 *///from w w w.j av  a 2s. co m
public void processArguments() {
    // For most objects we'd handle the multiple possibilities for initialization variables
    // as multiple constructors.  For Fragments, however, it's customary to use
    // setArguments / getArguments.
    if (getArguments() != null) {
        Bundle args = getArguments();
        if (args.containsKey(TEXT_KEY)) {
            mText = args.getString(TEXT_KEY);
            Log.d("Constructor", "Added Text.");
        } else if (args.containsKey(TEXT_ID_KEY)) {
            mTextId = args.getInt(TEXT_ID_KEY);
            mText = getString(mTextId);
        }
    }
}

From source file:com.dahl.brendan.wordsearch.model.HighScore.java

public HighScore(Bundle bundle) {
    this.time = bundle.getLong(Constants.KEY_HIGH_SCORE_TIME);
    this.size = bundle.getInt(Constants.KEY_HIGH_SCORE_SIZE);
    this.theme = bundle.getString(Constants.KEY_HIGH_SCORE_THEME);
    this.wordCount = bundle.getInt(Constants.KEY_WORD_COUNT);
    this.name = bundle.getString(Constants.KEY_HIGH_SCORE_NAME);
    this.globalRank = bundle.getInt(Constants.KEY_GLOBAL_RANK);
    this.globalHighScore = bundle.getBoolean(Constants.KEY_GLOBAL_HIGH_SCORE);
    this.rank = bundle.getInt(Constants.KEY_RANK);
    this.score = bundle.getLong(Constants.KEY_HIGH_SCORE);
}