List of usage examples for android.os Bundle containsKey
public boolean containsKey(String key)
From source file:com.dvn.vindecoder.ui.user.GetAllVehicalDetails.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // setContentView(R.layout.activity_get_all_vehical_details); // Watch for button clicks. /* Button button = (Button)findViewById(R.id.new_fragment); // www . j ava 2s. co m button.setOnClickListener(new OnClickListener() { public void onClick(View v) { addFragmentToStack(); } });*/ setTitle("Vehical details"); Bundle bundle = getIntent().getExtras(); if (bundle != null) { CommonURL.V_ID = bundle.getString("v_id"); v_id = bundle.getString("v_id"); CommonURL.PK_ID = v_id; if (bundle.containsKey("user_type")) { CommonURL.USER_TYPE = bundle.getInt("user_type"); ; } } drawChildLayout(); if (savedInstanceState == null) { // Do first time initialization -- add initial fragment. /* newFragment = GetNewVehicalFragment.newInstance(GetAllVehicalDetails.this); FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.add(R.id.fragment1, newFragment).commit();*/ addVehicalFragment_new_for_user = AddVehicalFragment_New_For_User .newInstance(GetAllVehicalDetails.this); FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.add(R.id.fragment1, addVehicalFragment_new_for_user).commit(); } else { mStackLevel = savedInstanceState.getInt("level"); } fab = (FloatingActionButton) findViewById(R.id.fab); TextView fab_txt = (TextView) findViewById(R.id.textView12); if (CommonURL.USER_TYPE == 1) { fab.setVisibility(View.GONE); fab_txt.setVisibility(View.GONE); } fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { //handleCameraForPickingPhoto(); openDialog(); } }); }
From source file:com.fuse.billing.android.IabHelper.java
int querySkuDetails(String itemType, List<String> skuList, List<SkuDetails> targetList) throws RemoteException, JSONException { logDebug("Querying SKU details."); if (skuList.size() == 0) { logDebug("queryPrices: nothing to do because there are no SKUs."); return BILLING_RESPONSE_RESULT_OK; }/*from w w w . j a v a2 s. co m*/ // Split the sku list in blocks of no more than 20 elements. ArrayList<ArrayList<String>> packs = new ArrayList<ArrayList<String>>(); ArrayList<String> currentPack = null; for (String sku : skuList) { if (isTestSku(sku)) { targetList.add(SkuDetails.createForTestProduct(sku)); } else { if (currentPack == null || currentPack.size() >= 20) { currentPack = new ArrayList<String>(); packs.add(currentPack); } currentPack.add(sku); } } for (ArrayList<String> skuPartList : packs) { Bundle querySkus = new Bundle(); querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuPartList); Bundle skuDetails = mService.getSkuDetails(3, mContext.getPackageName(), itemType, 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); targetList.add(d); } } return BILLING_RESPONSE_RESULT_OK; }
From source file:com.andrewshu.android.reddit.mail.InboxListActivity.java
/** * Called when the activity starts up. Do activity initialization * here, not in a constructor.//w w w . ja va 2 s .co m * * @see Activity#onCreate */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); CookieSyncManager.createInstance(getApplicationContext()); mSettings.loadRedditPreferences(this, mClient); setRequestedOrientation(mSettings.getRotation()); setTheme(mSettings.getTheme()); requestWindowFeature(Window.FEATURE_PROGRESS); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.inbox_list_content); registerForContextMenu(getListView()); if (mSettings.isLoggedIn()) { if (savedInstanceState != null) { mReplyTargetName = savedInstanceState.getString(Constants.REPLY_TARGET_NAME_KEY); mAfter = savedInstanceState.getString(Constants.AFTER_KEY); mBefore = savedInstanceState.getString(Constants.BEFORE_KEY); mCount = savedInstanceState.getInt(Constants.THREAD_COUNT_KEY); mLastAfter = savedInstanceState.getString(Constants.LAST_AFTER_KEY); mLastBefore = savedInstanceState.getString(Constants.LAST_BEFORE_KEY); mLastCount = savedInstanceState.getInt(Constants.THREAD_LAST_COUNT_KEY); mVoteTargetThingInfo = savedInstanceState.getParcelable(Constants.VOTE_TARGET_THING_INFO_KEY); mWhichInbox = savedInstanceState.getString(Constants.WHICH_INBOX_KEY); restoreLastNonConfigurationInstance(); if (mMessagesList == null) { // Load previous view of threads if (mLastAfter != null) { new DownloadMessagesTask(mWhichInbox, mLastAfter, null, mLastCount) .execute(Constants.DEFAULT_COMMENT_DOWNLOAD_LIMIT); } else if (mLastBefore != null) { new DownloadMessagesTask(mWhichInbox, null, mLastBefore, mLastCount) .execute(Constants.DEFAULT_COMMENT_DOWNLOAD_LIMIT); } else { new DownloadMessagesTask(mWhichInbox).execute(Constants.DEFAULT_COMMENT_DOWNLOAD_LIMIT); } } else { // Orientation change. Use prior instance. resetUI(new MessagesListAdapter(this, mMessagesList)); } } else { Bundle extras = getIntent().getExtras(); if (extras != null) { if (extras.containsKey(Constants.WHICH_INBOX_KEY)) mWhichInbox = extras.getString(Constants.WHICH_INBOX_KEY); } new DownloadMessagesTask(mWhichInbox).execute(Constants.DEFAULT_COMMENT_DOWNLOAD_LIMIT); } } else { showDialog(Constants.DIALOG_LOGIN); } setTitle(String.format(getResources().getString(R.string.inbox_title), mSettings.getUsername())); }
From source file:cm.aptoide.com.facebook.android.Facebook.java
/** * Make a request to Facebook's old (pre-graph) API with the given * parameters. One of the parameter keys must be "method" and its value * should be a valid REST server API method. * * See http://developers.facebook.com/docs/reference/rest/ * * Note that this method blocks waiting for a network response, so do not * call it in a UI thread./*from w ww .j av a2 s .c o m*/ * * Example: * <code> * Bundle parameters = new Bundle(); * parameters.putString("method", "auth.expireSession"); * String response = request(parameters); * </code> * * @param parameters * Key-value pairs of parameters to the request. Refer to the * documentation: one of the parameters must be "method". * @throws IOException * if a network error occurs * @throws MalformedURLException * if accessing an invalid endpoint * @throws IllegalArgumentException * if one of the parameters is not "method" * @return JSON string representation of the response */ public String request(Bundle parameters) throws MalformedURLException, IOException { if (!parameters.containsKey("method")) { throw new IllegalArgumentException( "API method must be specified. " + "(parameters must contain key \"method\" and value). See" + " http://developers.facebook.com/docs/reference/rest/"); } return request(null, parameters, "GET"); }
From source file:com.kyleshaver.minuteofangle.util.IabHelper.java
int querySkuDetails(String 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);/* w ww . j ava2 s . c o m*/ } } } if (skuList.size() == 0) { logDebug("queryPrices: nothing to do because there are no SKUs."); return BILLING_RESPONSE_RESULT_OK; } // Split the sku list in blocks of no more than 20 elements. ArrayList<ArrayList<String>> packs = new ArrayList<ArrayList<String>>(); ArrayList<String> tempList; int n = skuList.size() / 20; int mod = skuList.size() % 20; for (int i = 0; i < n; i++) { tempList = new ArrayList<String>(); for (String s : skuList.subList(i * 20, i * 20 + 20)) { tempList.add(s); } packs.add(tempList); } if (mod != 0) { tempList = new ArrayList<String>(); for (String s : skuList.subList(n * 20, n * 20 + mod)) { tempList.add(s); } packs.add(tempList); } for (ArrayList<String> skuPartList : packs) { Bundle querySkus = new Bundle(); querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuPartList); Bundle skuDetails = mService.getSkuDetails(3, mContext.getPackageName(), itemType, 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(itemType, thisResponse); logDebug("Got sku details: " + d); inv.addSkuDetails(d); } } return BILLING_RESPONSE_RESULT_OK; }
From source file:com.tealeaf.TeaLeaf.java
private String findAppID() { String appid = getIntent().getStringExtra("appid"); if (appid != null) { return appid; }// w w w . java2 s. c om // FIXME HACK: find a better way to determine the appID try { Bundle metaData = getPackageManager().getApplicationInfo(getPackageName(), PackageManager.GET_META_DATA).metaData; return metaData.containsKey("appID") ? metaData.get("appID").toString() : "tealeaf"; } catch (NameNotFoundException e) { logger.log(e); return "tealeaf"; } }
From source file:com.abplus.surroundcalc.billing.BillingHelper.java
int queryPurchases(Inventory inv) throws JSONException, RemoteException { boolean verificationFailed = false; String continueToken = null;// w w w . ja v a 2 s . c o m do { Bundle ownedItems = connection.getPurchases(continueToken); int response = getResponseCodeFromBundle(ownedItems); if (response != BILLING_RESPONSE_RESULT_OK) { return response; } if (!ownedItems.containsKey(RESPONSE_INAPP_ITEM_LIST) || !ownedItems.containsKey(RESPONSE_INAPP_PURCHASE_DATA_LIST) || !ownedItems.containsKey(RESPONSE_INAPP_SIGNATURE_LIST)) { return HELPER_BAD_RESPONSE; } ArrayList<String> purchaseDataList = ownedItems.getStringArrayList(RESPONSE_INAPP_PURCHASE_DATA_LIST); ArrayList<String> signatureList = ownedItems.getStringArrayList(RESPONSE_INAPP_SIGNATURE_LIST); for (int i = 0; i < purchaseDataList.size(); ++i) { String purchaseData = purchaseDataList.get(i); String signature = signatureList.get(i); if (security.verifyPurchase(purchaseData, signature)) { Purchase purchase = new Purchase(purchaseData, signature); inv.addPurchase(purchase); } else { verificationFailed = true; } } continueToken = ownedItems.getString(INAPP_CONTINUATION_TOKEN); } while (!TextUtils.isEmpty(continueToken)); return verificationFailed ? HELPER_VERIFICATION_FAILED : BILLING_RESPONSE_RESULT_OK; }
From source file:ca.mudar.parkcatcher.ui.activities.MainActivity.java
@Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); isCenterOnMyLocation = false;/*from w ww .ja va2 s. c o m*/ if (getIntent().hasExtra(Const.INTENT_EXTRA_POST_ID)) { try { final ActionBar ab = getSupportActionBar(); if (ab.getSelectedTab().getPosition() != Const.TABS_INDEX_MAP) { ab.setSelectedNavigationItem(Const.TABS_INDEX_MAP); } } catch (NullPointerException e) { e.printStackTrace(); } } else if ((savedInstanceState != null) && (savedInstanceState.containsKey(Const.KEY_BUNDLE_SELECTED_TAB))) { if (savedInstanceState.getString(Const.KEY_BUNDLE_SELECTED_TAB).equals(Const.TAG_TABS_FAVORITES)) { try { final ActionBar ab = getSupportActionBar(); if (ab.getSelectedTab().getPosition() != Const.TABS_INDEX_FAVORITES) { ab.setSelectedNavigationItem(Const.TABS_INDEX_FAVORITES); } } catch (NullPointerException e) { e.printStackTrace(); } } } }
From source file:de.geithonline.abattlwp.billinghelper.IabHelper.java
int querySkuDetails(final String itemType, final Inventory inv, final List<String> moreSkus) throws RemoteException, JSONException { logDebug("Querying SKU details."); final ArrayList<String> skuList = new ArrayList<String>(); skuList.addAll(inv.getAllOwnedSkus(itemType)); if (moreSkus != null) { for (final String sku : moreSkus) { if (!skuList.contains(sku)) { skuList.add(sku);//from w ww.j a va 2 s . com } } } if (skuList.size() == 0) { logDebug("queryPrices: nothing to do because there are no SKUs."); return BILLING_RESPONSE_RESULT_OK; } final Bundle querySkus = new Bundle(); querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuList); final Bundle skuDetails = mService.getSkuDetails(3, mContext.getPackageName(), itemType, querySkus); if (!skuDetails.containsKey(RESPONSE_GET_SKU_DETAILS_LIST)) { final 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; } } final ArrayList<String> responseList = skuDetails.getStringArrayList(RESPONSE_GET_SKU_DETAILS_LIST); for (final String thisResponse : responseList) { final SkuDetails d = new SkuDetails(itemType, thisResponse); logDebug("Got sku details: " + d); inv.addSkuDetails(d); } return BILLING_RESPONSE_RESULT_OK; }
From source file:com.almarsoft.GroundhogReader.ComposeActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mPrefs = PreferenceManager.getDefaultSharedPreferences(this); setContentView(R.layout.compose);/* w w w . j a v a2 s. c o m*/ mEdit_Groups = (EditText) this.findViewById(R.id.edit_groups); mEdit_Subject = (EditText) this.findViewById(R.id.edit_subject); mEdit_Body = (EditText) this.findViewById(R.id.edit_body); Button sendButton = (Button) this.findViewById(R.id.btn_send); Button discardButton = (Button) this.findViewById(R.id.btn_discard); sendButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { new AlertDialog.Builder(ComposeActivity.this).setTitle(getString(R.string.confirm_send)) .setMessage(getString(R.string.confirm_send_question)) .setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dlg, int sumthin) { ComposeActivity.this.postMessage(); } }).setNegativeButton(getString(R.string.no), null).show(); } }); discardButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { new AlertDialog.Builder(ComposeActivity.this).setTitle(getString(R.string.confirm_discard)) .setMessage(getString(R.string.confirm_discard_question)) .setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dlg, int sumthin) { ComposeActivity.this.finish(); } }).setNegativeButton(getString(R.string.no), null).show(); } }); this.setComposeSizeFromPrefs(0); // Get the header passed from the ; for the moment we only need the newsgroups and subject, // but we later will need more parts for posting Bundle extras = getIntent().getExtras(); mIsNew = extras.getBoolean("isNew"); mCurrentGroup = extras.getString("group"); Toast.makeText( getApplicationContext(), getString(R.string.encoding) + ": " + mPrefs.getString("postCharset", "ISO8859_15") + getString(R.string.change_encoding_tip), Toast.LENGTH_SHORT).show(); if (mIsNew) { mEdit_Groups.setText(mCurrentGroup); mEdit_Subject.requestFocus(); } else { String prevFrom = extras.getString("From"); String prevDate = extras.getString("Date"); String newsgroups = extras.getString("Newsgroups"); mMessageID = extras.getString("Message-ID"); if (extras.containsKey("References")) mReferences = extras.getString("References"); if (extras.containsKey("Subject")) { String prevSubject = extras.getString("Subject"); if (!prevSubject.toLowerCase().contains("re:")) { prevSubject = "Re: " + prevSubject; } mEdit_Subject.setText(prevSubject); } String followupOption = extras.getString("multipleFollowup"); if (followupOption == null || !followupOption.equalsIgnoreCase("CURRENT")) mEdit_Groups.setText(newsgroups); else mEdit_Groups.setText(mCurrentGroup); mEdit_Body.setText(""); // Get the quoted bodytext, set it and set the cursor at the configured position String bodyText = (String) extras.getString("bodytext"); boolean replyCursorStart = mPrefs.getBoolean("replyCursorPositionStart", false); String quoteheader = mPrefs.getString("authorline", "On [date], [user] said:"); String quotedBody = MessageTextProcessor.quoteBody(bodyText, quoteheader, prevFrom, prevDate); if (bodyText != null && bodyText.length() > 0) { if (replyCursorStart) { mEdit_Body.setText("\n\n" + quotedBody); mEdit_Body.setSelection(1); } else { mEdit_Body.setText(quotedBody + "\n\n"); mEdit_Body.setSelection(mEdit_Body.getText().length()); } } mEdit_Body.requestFocus(); } // End else isNew }