Example usage for android.os Bundle containsKey

List of usage examples for android.os Bundle containsKey

Introduction

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

Prototype

public boolean containsKey(String key) 

Source Link

Document

Returns true if the given key is contained in the mapping of this Bundle.

Usage

From source file:com.nearnotes.NoteEdit.java

@Override
public void onResume() {
    super.onResume();
    mCallback.setActionItems(NOTE_EDIT);
    if (mRowId == null) {
        Bundle extras = getArguments();
        if (!extras.containsKey(NotesDbAdapter.KEY_ROWID)) {
            mTitleText.setText("");
        }/*  w w  w . j  a  v  a2s  . c o m*/
        mRowId = extras.containsKey(NotesDbAdapter.KEY_ROWID) ? extras.getLong(NotesDbAdapter.KEY_ROWID) : null;
    }
    mTblAddLayout.removeAllViews();
    populateFields();
}

From source file:com.appolis.receiving.AcReceiveOptionMove.java

@SuppressWarnings("unchecked")
@Override// w  w  w.  j  a  v  a2 s  . c  o  m
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.move_details_layout);
    languagePrefs = new LanguagePreferences(getApplicationContext());
    scanFlag = GlobalParams.FLAG_ACTIVE;

    Bundle bundle = getIntent().getExtras();
    if (bundle.containsKey(GlobalParams.PARAM_EN_PURCHASE_ORDER_INFOS)) {
        enPurchaseOrderInfo = (EnPurchaseOrderInfo) bundle.get(GlobalParams.PARAM_EN_PURCHASE_ORDER_INFOS);
    }

    if (bundle.containsKey(GlobalParams.PARAM_EN_PURCHASE_ORDER_ITEM_INFOS)) {
        enPurchaseOrderItemInfo = (EnPurchaseOrderItemInfo) bundle
                .get(GlobalParams.PARAM_EN_PURCHASE_ORDER_ITEM_INFOS);
    }

    if (bundle.containsKey(GlobalParams.PARAM_LIST_EN_PURCHASE_ORDER_RECEIPT_INFO)) {
        listReceiptInfos = (ArrayList<EnPurchaseOrderReceiptInfo>) bundle
                .get(GlobalParams.PARAM_LIST_EN_PURCHASE_ORDER_RECEIPT_INFO);
    }

    getMultipleLanguage();

    initLayout();
}

From source file:com.ryan.ryanreader.fragments.CommentListingFragment.java

@Override
public void onCreate(final Bundle savedInstanceState) {
    // TODO load position/etc?
    super.onCreate(savedInstanceState);

    setHasOptionsMenu(true);/*w w  w  .j ava 2s .c o  m*/

    final Bundle arguments = getArguments();

    parentPostIdAndType = arguments.getString("parentPostIdAndType");

    url = General.uriFromString(arguments.getString("url"));

    if (arguments.containsKey("session")) {
        session = UUID.fromString(arguments.getString("session"));
    }

    downloadType = CacheRequest.DownloadType.valueOf(arguments.getString("downloadType"));
}

From source file:com.example.alvarpao.popularmovies.MovieGridFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    // Add the below line in order for this fragment to display and handle menu options.
    setHasOptionsMenu(true);/*from  ww  w  .  j  av  a 2s.com*/

    if (savedInstanceState != null) {
        //State needs to be restored for this activity, a rotation occurred
        if (savedInstanceState.containsKey(LOADED_MOVIES))
            mMovies = savedInstanceState.getParcelableArrayList(LOADED_MOVIES);
        if (savedInstanceState.containsKey(PAGE_TO_FETCH))
            mPageToFetch = savedInstanceState.getInt(PAGE_TO_FETCH);
        if (savedInstanceState.containsKey(LOADED_PREVIOUS_ITEMS))
            mPreviousTotalItems = savedInstanceState.getInt(LOADED_PREVIOUS_ITEMS);
        if (savedInstanceState.containsKey(SELECTION_OCCURRED))
            mSelectionOccurred = savedInstanceState.getBoolean(SELECTION_OCCURRED);
        if (savedInstanceState.containsKey(CURRENT_SCROLL_POSITION))
            mCurrentScrollPosition = savedInstanceState.getInt(CURRENT_SCROLL_POSITION);
    }

    else
        mMovies = new ArrayList<Movie>();
}

From source file:com.buddi.client.dfu.DfuActivity.java

@Override
protected void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
    if (resultCode != RESULT_OK)
        return;/* w w  w.j av  a 2s. c  o m*/

    switch (requestCode) {
    case SELECT_FILE_REQ:
        // clear previous data
        mFileType = mFileTypeTmp;
        mFilePath = null;
        mFileStreamUri = null;

        // and read new one
        final Uri uri = data.getData();
        /*
         * The URI returned from application may be in 'file' or 'content' schema.
         * 'File' schema allows us to create a File object and read details from if directly.
         * Data from 'Content' schema must be read by Content Provider. To do that we are using a Loader.
         */
        if (uri.getScheme().equals("file")) {
            // the direct path to the file has been returned
            final String path = uri.getPath();
            final File file = new File(path);
            mFilePath = path;

            updateFileInfo(file.getName(), file.length(), mFileType);
        } else if (uri.getScheme().equals("content")) {
            // an Uri has been returned
            mFileStreamUri = uri;
            // if application returned Uri for streaming, let's us it. Does it works?
            // FIXME both Uris works with Google Drive app. Why both? What's the difference? How about other apps like DropBox?
            final Bundle extras = data.getExtras();
            if (extras != null && extras.containsKey(Intent.EXTRA_STREAM))
                mFileStreamUri = extras.getParcelable(Intent.EXTRA_STREAM);

            // file name and size must be obtained from Content Provider
            final Bundle bundle = new Bundle();
            bundle.putParcelable(EXTRA_URI, uri);
            //getSupportLoaderManager().restartLoader(0, bundle, this);
            getLoaderManager().restartLoader(0, bundle, this);
        }
        break;
    default:
        break;
    }
}

From source file:com.github.gorbin.asne.googleplus.GooglePlusSocialNetwork.java

/**
 * Request Google plus share dialog/*from www.  ja  v  a  2 s. c om*/
 * @param bundle bundle containing information that should be shared(Bundle constants in {@link com.github.gorbin.asne.core.SocialNetwork})
 * @param onPostingCompleteListener listener for posting request
 */
@Override
public void requestPostDialog(Bundle bundle, OnPostingCompleteListener onPostingCompleteListener) {
    super.requestPostDialog(bundle, onPostingCompleteListener);
    PlusShare.Builder plusShare = new PlusShare.Builder(mActivity).setType("text/plain");
    if (bundle != null) {
        if (bundle.containsKey(BUNDLE_MESSAGE)) {
            plusShare.setText(bundle.getString(BUNDLE_MESSAGE));
        }
        if (bundle.containsKey(BUNDLE_LINK)) {
            plusShare.setContentUrl(Uri.parse(bundle.getString(BUNDLE_LINK)));
        }
    }
    Intent shareIntent = plusShare.getIntent();
    mActivity.startActivityForResult(shareIntent, 0);
}

From source file:com.evolup.test.IAPTest01.util.IabHelper.java

int querySkuDetails(Inventory inv, List<String> moreSkus) throws RemoteException, JSONException {
    logDebug("Querying SKU details.");
    ArrayList<String> skuList = new ArrayList<String>();
    skuList.addAll(inv.getAllOwnedSkus());
    if (moreSkus != null)
        skuList.addAll(moreSkus);/*from www.j a v  a  2  s . com*/

    if (skuList.size() == 0) {
        logDebug("queryPrices: nothing to do because there are no SKUs.");
        return BILLING_RESPONSE_RESULT_OK;
    }

    Bundle querySkus = new Bundle();
    querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuList);
    Bundle skuDetails = mService.getSkuDetails(3, mContext.getPackageName(), ITEM_TYPE_INAPP, querySkus);

    if (!skuDetails.containsKey(RESPONSE_GET_SKU_DETAILS_LIST)) {
        int response = getResponseCodeFromBundle(skuDetails);
        if (response != BILLING_RESPONSE_RESULT_OK) {
            logDebug("getSkuDetails() failed: " + getResponseDesc(response));
            return response;
        } else {
            logError("getSkuDetails() returned a bundle with neither an error nor a detail list.");
            return IABHELPER_BAD_RESPONSE;
        }
    }

    ArrayList<String> responseList = skuDetails.getStringArrayList(RESPONSE_GET_SKU_DETAILS_LIST);

    for (String thisResponse : responseList) {
        SkuDetails d = new SkuDetails(thisResponse);
        logDebug("Got sku details: " + d);
        inv.addSkuDetails(d);
    }
    return BILLING_RESPONSE_RESULT_OK;
}

From source file:com.github.jberkel.pay.me.IabHelper.java

private int querySkuDetails(ItemType itemType, Inventory inv, List<String> moreSkus)
        throws RemoteException, JSONException {
    logDebug("Querying SKU details.");
    ArrayList<String> skuList = new ArrayList<String>();
    skuList.addAll(inv.getAllOwnedSkus(itemType));
    if (moreSkus != null) {
        for (String sku : moreSkus) {
            if (!skuList.contains(sku)) {
                skuList.add(sku);// www .ja va  2 s  . com
            }
        }
    }
    if (skuList.isEmpty()) {
        logDebug("querySkuDetails: nothing to do because there are no SKUs.");
        return OK.code;
    }

    // TODO: check for 20 SKU limit + add batching ?
    Bundle querySkus = new Bundle();
    querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuList);
    Bundle skuDetails = mService.getSkuDetails(API_VERSION, mContext.getPackageName(), itemType.toString(),
            querySkus);
    if (skuDetails == null)
        return IABHELPER_BAD_RESPONSE.code;

    if (!skuDetails.containsKey(RESPONSE_GET_SKU_DETAILS_LIST)) {
        int response = getResponseCodeFromBundle(skuDetails);
        if (response != OK.code) {
            logWarn("getSkuDetails() failed: " + getDescription(response));
            return response;
        } else {
            logError("getSkuDetails() returned a bundle with neither an error nor a detail list.");
            return IABHELPER_BAD_RESPONSE.code;
        }
    }
    ArrayList<String> responseList = skuDetails.getStringArrayList(RESPONSE_GET_SKU_DETAILS_LIST);
    for (String json : responseList) {
        inv.addSkuDetails(new SkuDetails(json));
    }
    return OK.code;
}