PageRenderTime 51ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/android/generated/android/os/Bundle.cs

https://bitbucket.org/festevezga/xobotos
C# | 1640 lines | 831 code | 90 blank | 719 comment | 73 complexity | d71b24f1e9769a9f5dfa7ac8dead9f6b MD5 | raw file
  1. using Sharpen;
  2. namespace android.os
  3. {
  4. /// <summary>A mapping from String values to various Parcelable types.</summary>
  5. /// <remarks>A mapping from String values to various Parcelable types.</remarks>
  6. [Sharpen.Sharpened]
  7. public sealed partial class Bundle : android.os.Parcelable, System.ICloneable
  8. {
  9. internal const string LOG_TAG = "Bundle";
  10. public static readonly android.os.Bundle EMPTY;
  11. static Bundle()
  12. {
  13. EMPTY = new android.os.Bundle();
  14. EMPTY.mMap = java.util.Collections.unmodifiableMap<string, object>(new java.util.HashMap
  15. <string, object>());
  16. }
  17. internal java.util.Map<string, object> mMap = null;
  18. internal android.os.Parcel mParcelledData = null;
  19. private bool mHasFds = false;
  20. private bool mFdsKnown = true;
  21. private bool mAllowFds = true;
  22. /// <summary>The ClassLoader used when unparcelling data from mParcelledData.</summary>
  23. /// <remarks>The ClassLoader used when unparcelling data from mParcelledData.</remarks>
  24. private java.lang.ClassLoader mClassLoader;
  25. /// <summary>Constructs a new, empty Bundle.</summary>
  26. /// <remarks>Constructs a new, empty Bundle.</remarks>
  27. public Bundle()
  28. {
  29. // Invariant - exactly one of mMap / mParcelledData will be null
  30. // (except inside a call to unparcel)
  31. mMap = new java.util.HashMap<string, object>();
  32. mClassLoader = XobotOS.Runtime.Reflection.GetClassLoader(GetType());
  33. }
  34. /// <summary>Constructs a Bundle whose data is stored as a Parcel.</summary>
  35. /// <remarks>
  36. /// Constructs a Bundle whose data is stored as a Parcel. The data
  37. /// will be unparcelled on first contact, using the assigned ClassLoader.
  38. /// </remarks>
  39. /// <param name="parcelledData">a Parcel containing a Bundle</param>
  40. internal Bundle(android.os.Parcel parcelledData)
  41. {
  42. readFromParcel(parcelledData);
  43. }
  44. internal Bundle(android.os.Parcel parcelledData, int length)
  45. {
  46. readFromParcelInner(parcelledData, length);
  47. }
  48. /// <summary>
  49. /// Constructs a new, empty Bundle that uses a specific ClassLoader for
  50. /// instantiating Parcelable and Serializable objects.
  51. /// </summary>
  52. /// <remarks>
  53. /// Constructs a new, empty Bundle that uses a specific ClassLoader for
  54. /// instantiating Parcelable and Serializable objects.
  55. /// </remarks>
  56. /// <param name="loader">
  57. /// An explicit ClassLoader to use when instantiating objects
  58. /// inside of the Bundle.
  59. /// </param>
  60. public Bundle(java.lang.ClassLoader loader)
  61. {
  62. mMap = new java.util.HashMap<string, object>();
  63. mClassLoader = loader;
  64. }
  65. /// <summary>
  66. /// Constructs a new, empty Bundle sized to hold the given number of
  67. /// elements.
  68. /// </summary>
  69. /// <remarks>
  70. /// Constructs a new, empty Bundle sized to hold the given number of
  71. /// elements. The Bundle will grow as needed.
  72. /// </remarks>
  73. /// <param name="capacity">the initial capacity of the Bundle</param>
  74. public Bundle(int capacity)
  75. {
  76. mMap = new java.util.HashMap<string, object>(capacity);
  77. mClassLoader = XobotOS.Runtime.Reflection.GetClassLoader(GetType());
  78. }
  79. /// <summary>
  80. /// Constructs a Bundle containing a copy of the mappings from the given
  81. /// Bundle.
  82. /// </summary>
  83. /// <remarks>
  84. /// Constructs a Bundle containing a copy of the mappings from the given
  85. /// Bundle.
  86. /// </remarks>
  87. /// <param name="b">a Bundle to be copied.</param>
  88. public Bundle(android.os.Bundle b)
  89. {
  90. if (b.mParcelledData != null)
  91. {
  92. mParcelledData = android.os.Parcel.obtain();
  93. mParcelledData.appendFrom(b.mParcelledData, 0, b.mParcelledData.dataSize());
  94. mParcelledData.setDataPosition(0);
  95. }
  96. else
  97. {
  98. mParcelledData = null;
  99. }
  100. if (b.mMap != null)
  101. {
  102. mMap = new java.util.HashMap<string, object>(b.mMap);
  103. }
  104. else
  105. {
  106. mMap = null;
  107. }
  108. mHasFds = b.mHasFds;
  109. mFdsKnown = b.mFdsKnown;
  110. mClassLoader = b.mClassLoader;
  111. }
  112. /// <summary>Make a Bundle for a single key/value pair.</summary>
  113. /// <remarks>Make a Bundle for a single key/value pair.</remarks>
  114. /// <hide></hide>
  115. public static android.os.Bundle forPair(string key, string value)
  116. {
  117. // TODO: optimize this case.
  118. android.os.Bundle b = new android.os.Bundle(1);
  119. b.putString(key, value);
  120. return b;
  121. }
  122. /// <summary>
  123. /// TODO: optimize this later (getting just the value part of a Bundle
  124. /// with a single pair) once Bundle.forPair() above is implemented
  125. /// with a special single-value Map implementation/serialization.
  126. /// </summary>
  127. /// <remarks>
  128. /// TODO: optimize this later (getting just the value part of a Bundle
  129. /// with a single pair) once Bundle.forPair() above is implemented
  130. /// with a special single-value Map implementation/serialization.
  131. /// Note: value in single-pair Bundle may be null.
  132. /// </remarks>
  133. /// <hide></hide>
  134. public string getPairValue()
  135. {
  136. unparcel();
  137. int size_1 = mMap.size();
  138. if (size_1 > 1)
  139. {
  140. android.util.Log.w(LOG_TAG, "getPairValue() used on Bundle with multiple pairs.");
  141. }
  142. if (size_1 == 0)
  143. {
  144. return null;
  145. }
  146. object o = mMap.values().iterator().next();
  147. try
  148. {
  149. return (string)o;
  150. }
  151. catch (System.InvalidCastException e)
  152. {
  153. typeWarning("getPairValue()", o, "String", e);
  154. return null;
  155. }
  156. }
  157. /// <summary>Changes the ClassLoader this Bundle uses when instantiating objects.</summary>
  158. /// <remarks>Changes the ClassLoader this Bundle uses when instantiating objects.</remarks>
  159. /// <param name="loader">
  160. /// An explicit ClassLoader to use when instantiating objects
  161. /// inside of the Bundle.
  162. /// </param>
  163. public void setClassLoader(java.lang.ClassLoader loader)
  164. {
  165. mClassLoader = loader;
  166. }
  167. /// <summary>Return the ClassLoader currently associated with this Bundle.</summary>
  168. /// <remarks>Return the ClassLoader currently associated with this Bundle.</remarks>
  169. public java.lang.ClassLoader getClassLoader()
  170. {
  171. return mClassLoader;
  172. }
  173. /// <hide></hide>
  174. public bool setAllowFds(bool allowFds)
  175. {
  176. bool orig = mAllowFds;
  177. mAllowFds = allowFds;
  178. return orig;
  179. }
  180. /// <summary>Clones the current Bundle.</summary>
  181. /// <remarks>
  182. /// Clones the current Bundle. The internal map is cloned, but the keys and
  183. /// values to which it refers are copied by reference.
  184. /// </remarks>
  185. public object clone()
  186. {
  187. return new android.os.Bundle(this);
  188. }
  189. /// <summary>Returns the number of mappings contained in this Bundle.</summary>
  190. /// <remarks>Returns the number of mappings contained in this Bundle.</remarks>
  191. /// <returns>the number of mappings as an int.</returns>
  192. public int size()
  193. {
  194. unparcel();
  195. return mMap.size();
  196. }
  197. /// <summary>Returns true if the mapping of this Bundle is empty, false otherwise.</summary>
  198. /// <remarks>Returns true if the mapping of this Bundle is empty, false otherwise.</remarks>
  199. public bool isEmpty()
  200. {
  201. unparcel();
  202. return mMap.isEmpty();
  203. }
  204. /// <summary>Removes all elements from the mapping of this Bundle.</summary>
  205. /// <remarks>Removes all elements from the mapping of this Bundle.</remarks>
  206. public void clear()
  207. {
  208. unparcel();
  209. mMap.clear();
  210. mHasFds = false;
  211. mFdsKnown = true;
  212. }
  213. /// <summary>
  214. /// Returns true if the given key is contained in the mapping
  215. /// of this Bundle.
  216. /// </summary>
  217. /// <remarks>
  218. /// Returns true if the given key is contained in the mapping
  219. /// of this Bundle.
  220. /// </remarks>
  221. /// <param name="key">a String key</param>
  222. /// <returns>true if the key is part of the mapping, false otherwise</returns>
  223. public bool containsKey(string key)
  224. {
  225. unparcel();
  226. return mMap.containsKey(key);
  227. }
  228. /// <summary>Returns the entry with the given key as an object.</summary>
  229. /// <remarks>Returns the entry with the given key as an object.</remarks>
  230. /// <param name="key">a String key</param>
  231. /// <returns>an Object, or null</returns>
  232. public object get(string key)
  233. {
  234. unparcel();
  235. return mMap.get(key);
  236. }
  237. /// <summary>Removes any entry with the given key from the mapping of this Bundle.</summary>
  238. /// <remarks>Removes any entry with the given key from the mapping of this Bundle.</remarks>
  239. /// <param name="key">a String key</param>
  240. public void remove(string key)
  241. {
  242. unparcel();
  243. mMap.remove(key);
  244. }
  245. /// <summary>Inserts all mappings from the given Bundle into this Bundle.</summary>
  246. /// <remarks>Inserts all mappings from the given Bundle into this Bundle.</remarks>
  247. /// <param name="map">a Bundle</param>
  248. public void putAll(android.os.Bundle map)
  249. {
  250. unparcel();
  251. map.unparcel();
  252. mMap.putAll(map.mMap);
  253. // fd state is now known if and only if both bundles already knew
  254. mHasFds |= map.mHasFds;
  255. mFdsKnown = mFdsKnown && map.mFdsKnown;
  256. }
  257. /// <summary>Returns a Set containing the Strings used as keys in this Bundle.</summary>
  258. /// <remarks>Returns a Set containing the Strings used as keys in this Bundle.</remarks>
  259. /// <returns>a Set of String keys</returns>
  260. public java.util.Set<string> keySet()
  261. {
  262. unparcel();
  263. return mMap.keySet();
  264. }
  265. /// <summary>Reports whether the bundle contains any parcelled file descriptors.</summary>
  266. /// <remarks>Reports whether the bundle contains any parcelled file descriptors.</remarks>
  267. public bool hasFileDescriptors()
  268. {
  269. if (!mFdsKnown)
  270. {
  271. bool fdFound = false;
  272. // keep going until we find one or run out of data
  273. if (mParcelledData != null)
  274. {
  275. if (mParcelledData.hasFileDescriptors())
  276. {
  277. fdFound = true;
  278. }
  279. }
  280. else
  281. {
  282. // It's been unparcelled, so we need to walk the map
  283. java.util.Iterator<java.util.MapClass.Entry<string, object>> iter = mMap.entrySet
  284. ().iterator();
  285. while (!fdFound && iter.hasNext())
  286. {
  287. object obj = iter.next().getValue();
  288. if (obj is android.os.Parcelable)
  289. {
  290. if ((((android.os.Parcelable)obj).describeContents() & android.os.ParcelableClass.CONTENTS_FILE_DESCRIPTOR
  291. ) != 0)
  292. {
  293. fdFound = true;
  294. break;
  295. }
  296. }
  297. else
  298. {
  299. if (obj is android.os.Parcelable[])
  300. {
  301. android.os.Parcelable[] array = (android.os.Parcelable[])obj;
  302. {
  303. for (int n = array.Length - 1; n >= 0; n--)
  304. {
  305. if ((array[n].describeContents() & android.os.ParcelableClass.CONTENTS_FILE_DESCRIPTOR
  306. ) != 0)
  307. {
  308. fdFound = true;
  309. break;
  310. }
  311. }
  312. }
  313. }
  314. else
  315. {
  316. if (obj is android.util.SparseArray<object>)
  317. {
  318. android.util.SparseArray<android.os.Parcelable> array = (android.util.SparseArray
  319. <android.os.Parcelable>)obj;
  320. {
  321. for (int n = array.size() - 1; n >= 0; n--)
  322. {
  323. if ((array.get(n).describeContents() & android.os.ParcelableClass.CONTENTS_FILE_DESCRIPTOR
  324. ) != 0)
  325. {
  326. fdFound = true;
  327. break;
  328. }
  329. }
  330. }
  331. }
  332. else
  333. {
  334. if (obj is java.util.ArrayList<object>)
  335. {
  336. java.util.ArrayList<object> array = (java.util.ArrayList<object>)obj;
  337. // an ArrayList here might contain either Strings or
  338. // Parcelables; only look inside for Parcelables
  339. if ((array.size() > 0) && (array.get(0) is android.os.Parcelable))
  340. {
  341. {
  342. for (int n = array.size() - 1; n >= 0; n--)
  343. {
  344. android.os.Parcelable p = (android.os.Parcelable)array.get(n);
  345. if (p != null && ((p.describeContents() & android.os.ParcelableClass.CONTENTS_FILE_DESCRIPTOR
  346. ) != 0))
  347. {
  348. fdFound = true;
  349. break;
  350. }
  351. }
  352. }
  353. }
  354. }
  355. }
  356. }
  357. }
  358. }
  359. }
  360. mHasFds = fdFound;
  361. mFdsKnown = true;
  362. }
  363. return mHasFds;
  364. }
  365. /// <summary>
  366. /// Inserts a Boolean value into the mapping of this Bundle, replacing
  367. /// any existing value for the given key.
  368. /// </summary>
  369. /// <remarks>
  370. /// Inserts a Boolean value into the mapping of this Bundle, replacing
  371. /// any existing value for the given key. Either key or value may be null.
  372. /// </remarks>
  373. /// <param name="key">a String, or null</param>
  374. /// <param name="value">a Boolean, or null</param>
  375. public void putBoolean(string key, bool value)
  376. {
  377. unparcel();
  378. mMap.put(key, value);
  379. }
  380. /// <summary>
  381. /// Inserts a byte value into the mapping of this Bundle, replacing
  382. /// any existing value for the given key.
  383. /// </summary>
  384. /// <remarks>
  385. /// Inserts a byte value into the mapping of this Bundle, replacing
  386. /// any existing value for the given key.
  387. /// </remarks>
  388. /// <param name="key">a String, or null</param>
  389. /// <param name="value">a byte</param>
  390. public void putByte(string key, byte value)
  391. {
  392. unparcel();
  393. mMap.put(key, value);
  394. }
  395. /// <summary>
  396. /// Inserts a char value into the mapping of this Bundle, replacing
  397. /// any existing value for the given key.
  398. /// </summary>
  399. /// <remarks>
  400. /// Inserts a char value into the mapping of this Bundle, replacing
  401. /// any existing value for the given key.
  402. /// </remarks>
  403. /// <param name="key">a String, or null</param>
  404. /// <param name="value">a char, or null</param>
  405. public void putChar(string key, char value)
  406. {
  407. unparcel();
  408. mMap.put(key, value);
  409. }
  410. /// <summary>
  411. /// Inserts a short value into the mapping of this Bundle, replacing
  412. /// any existing value for the given key.
  413. /// </summary>
  414. /// <remarks>
  415. /// Inserts a short value into the mapping of this Bundle, replacing
  416. /// any existing value for the given key.
  417. /// </remarks>
  418. /// <param name="key">a String, or null</param>
  419. /// <param name="value">a short</param>
  420. public void putShort(string key, short value)
  421. {
  422. unparcel();
  423. mMap.put(key, value);
  424. }
  425. /// <summary>
  426. /// Inserts an int value into the mapping of this Bundle, replacing
  427. /// any existing value for the given key.
  428. /// </summary>
  429. /// <remarks>
  430. /// Inserts an int value into the mapping of this Bundle, replacing
  431. /// any existing value for the given key.
  432. /// </remarks>
  433. /// <param name="key">a String, or null</param>
  434. /// <param name="value">an int, or null</param>
  435. public void putInt(string key, int value)
  436. {
  437. unparcel();
  438. mMap.put(key, value);
  439. }
  440. /// <summary>
  441. /// Inserts a long value into the mapping of this Bundle, replacing
  442. /// any existing value for the given key.
  443. /// </summary>
  444. /// <remarks>
  445. /// Inserts a long value into the mapping of this Bundle, replacing
  446. /// any existing value for the given key.
  447. /// </remarks>
  448. /// <param name="key">a String, or null</param>
  449. /// <param name="value">a long</param>
  450. public void putLong(string key, long value)
  451. {
  452. unparcel();
  453. mMap.put(key, value);
  454. }
  455. /// <summary>
  456. /// Inserts a float value into the mapping of this Bundle, replacing
  457. /// any existing value for the given key.
  458. /// </summary>
  459. /// <remarks>
  460. /// Inserts a float value into the mapping of this Bundle, replacing
  461. /// any existing value for the given key.
  462. /// </remarks>
  463. /// <param name="key">a String, or null</param>
  464. /// <param name="value">a float</param>
  465. public void putFloat(string key, float value)
  466. {
  467. unparcel();
  468. mMap.put(key, value);
  469. }
  470. /// <summary>
  471. /// Inserts a double value into the mapping of this Bundle, replacing
  472. /// any existing value for the given key.
  473. /// </summary>
  474. /// <remarks>
  475. /// Inserts a double value into the mapping of this Bundle, replacing
  476. /// any existing value for the given key.
  477. /// </remarks>
  478. /// <param name="key">a String, or null</param>
  479. /// <param name="value">a double</param>
  480. public void putDouble(string key, double value)
  481. {
  482. unparcel();
  483. mMap.put(key, value);
  484. }
  485. /// <summary>
  486. /// Inserts a String value into the mapping of this Bundle, replacing
  487. /// any existing value for the given key.
  488. /// </summary>
  489. /// <remarks>
  490. /// Inserts a String value into the mapping of this Bundle, replacing
  491. /// any existing value for the given key. Either key or value may be null.
  492. /// </remarks>
  493. /// <param name="key">a String, or null</param>
  494. /// <param name="value">a String, or null</param>
  495. public void putString(string key, string value)
  496. {
  497. unparcel();
  498. mMap.put(key, value);
  499. }
  500. /// <summary>
  501. /// Inserts a CharSequence value into the mapping of this Bundle, replacing
  502. /// any existing value for the given key.
  503. /// </summary>
  504. /// <remarks>
  505. /// Inserts a CharSequence value into the mapping of this Bundle, replacing
  506. /// any existing value for the given key. Either key or value may be null.
  507. /// </remarks>
  508. /// <param name="key">a String, or null</param>
  509. /// <param name="value">a CharSequence, or null</param>
  510. public void putCharSequence(string key, java.lang.CharSequence value)
  511. {
  512. unparcel();
  513. mMap.put(key, value);
  514. }
  515. /// <summary>
  516. /// Inserts a Parcelable value into the mapping of this Bundle, replacing
  517. /// any existing value for the given key.
  518. /// </summary>
  519. /// <remarks>
  520. /// Inserts a Parcelable value into the mapping of this Bundle, replacing
  521. /// any existing value for the given key. Either key or value may be null.
  522. /// </remarks>
  523. /// <param name="key">a String, or null</param>
  524. /// <param name="value">a Parcelable object, or null</param>
  525. public void putParcelable(string key, android.os.Parcelable value)
  526. {
  527. unparcel();
  528. mMap.put(key, value);
  529. mFdsKnown = false;
  530. }
  531. /// <summary>
  532. /// Inserts an array of Parcelable values into the mapping of this Bundle,
  533. /// replacing any existing value for the given key.
  534. /// </summary>
  535. /// <remarks>
  536. /// Inserts an array of Parcelable values into the mapping of this Bundle,
  537. /// replacing any existing value for the given key. Either key or value may
  538. /// be null.
  539. /// </remarks>
  540. /// <param name="key">a String, or null</param>
  541. /// <param name="value">an array of Parcelable objects, or null</param>
  542. public void putParcelableArray(string key, android.os.Parcelable[] value)
  543. {
  544. unparcel();
  545. mMap.put(key, value);
  546. mFdsKnown = false;
  547. }
  548. /// <summary>
  549. /// Inserts a List of Parcelable values into the mapping of this Bundle,
  550. /// replacing any existing value for the given key.
  551. /// </summary>
  552. /// <remarks>
  553. /// Inserts a List of Parcelable values into the mapping of this Bundle,
  554. /// replacing any existing value for the given key. Either key or value may
  555. /// be null.
  556. /// </remarks>
  557. /// <param name="key">a String, or null</param>
  558. /// <param name="value">an ArrayList of Parcelable objects, or null</param>
  559. public void putParcelableArrayList<_T0>(string key, java.util.ArrayList<_T0> value
  560. ) where _T0:android.os.Parcelable
  561. {
  562. unparcel();
  563. mMap.put(key, value);
  564. mFdsKnown = false;
  565. }
  566. /// <summary>
  567. /// Inserts an ArrayList<Integer> value into the mapping of this Bundle, replacing
  568. /// any existing value for the given key.
  569. /// </summary>
  570. /// <remarks>
  571. /// Inserts an ArrayList<Integer> value into the mapping of this Bundle, replacing
  572. /// any existing value for the given key. Either key or value may be null.
  573. /// </remarks>
  574. /// <param name="key">a String, or null</param>
  575. /// <param name="value">an ArrayList<Integer> object, or null</param>
  576. public void putIntegerArrayList(string key, java.util.ArrayList<int> value)
  577. {
  578. unparcel();
  579. mMap.put(key, value);
  580. }
  581. /// <summary>
  582. /// Inserts an ArrayList<String> value into the mapping of this Bundle, replacing
  583. /// any existing value for the given key.
  584. /// </summary>
  585. /// <remarks>
  586. /// Inserts an ArrayList<String> value into the mapping of this Bundle, replacing
  587. /// any existing value for the given key. Either key or value may be null.
  588. /// </remarks>
  589. /// <param name="key">a String, or null</param>
  590. /// <param name="value">an ArrayList<String> object, or null</param>
  591. public void putStringArrayList(string key, java.util.ArrayList<string> value)
  592. {
  593. unparcel();
  594. mMap.put(key, value);
  595. }
  596. /// <summary>
  597. /// Inserts an ArrayList<CharSequence> value into the mapping of this Bundle, replacing
  598. /// any existing value for the given key.
  599. /// </summary>
  600. /// <remarks>
  601. /// Inserts an ArrayList<CharSequence> value into the mapping of this Bundle, replacing
  602. /// any existing value for the given key. Either key or value may be null.
  603. /// </remarks>
  604. /// <param name="key">a String, or null</param>
  605. /// <param name="value">an ArrayList<CharSequence> object, or null</param>
  606. public void putCharSequenceArrayList(string key, java.util.ArrayList<java.lang.CharSequence
  607. > value)
  608. {
  609. unparcel();
  610. mMap.put(key, value);
  611. }
  612. /// <summary>
  613. /// Inserts a Serializable value into the mapping of this Bundle, replacing
  614. /// any existing value for the given key.
  615. /// </summary>
  616. /// <remarks>
  617. /// Inserts a Serializable value into the mapping of this Bundle, replacing
  618. /// any existing value for the given key. Either key or value may be null.
  619. /// </remarks>
  620. /// <param name="key">a String, or null</param>
  621. /// <param name="value">a Serializable object, or null</param>
  622. public void putSerializable(string key, java.io.Serializable value)
  623. {
  624. unparcel();
  625. mMap.put(key, value);
  626. }
  627. /// <summary>
  628. /// Inserts a boolean array value into the mapping of this Bundle, replacing
  629. /// any existing value for the given key.
  630. /// </summary>
  631. /// <remarks>
  632. /// Inserts a boolean array value into the mapping of this Bundle, replacing
  633. /// any existing value for the given key. Either key or value may be null.
  634. /// </remarks>
  635. /// <param name="key">a String, or null</param>
  636. /// <param name="value">a boolean array object, or null</param>
  637. public void putBooleanArray(string key, bool[] value)
  638. {
  639. unparcel();
  640. mMap.put(key, value);
  641. }
  642. /// <summary>
  643. /// Inserts a byte array value into the mapping of this Bundle, replacing
  644. /// any existing value for the given key.
  645. /// </summary>
  646. /// <remarks>
  647. /// Inserts a byte array value into the mapping of this Bundle, replacing
  648. /// any existing value for the given key. Either key or value may be null.
  649. /// </remarks>
  650. /// <param name="key">a String, or null</param>
  651. /// <param name="value">a byte array object, or null</param>
  652. public void putByteArray(string key, byte[] value)
  653. {
  654. unparcel();
  655. mMap.put(key, value);
  656. }
  657. /// <summary>
  658. /// Inserts a short array value into the mapping of this Bundle, replacing
  659. /// any existing value for the given key.
  660. /// </summary>
  661. /// <remarks>
  662. /// Inserts a short array value into the mapping of this Bundle, replacing
  663. /// any existing value for the given key. Either key or value may be null.
  664. /// </remarks>
  665. /// <param name="key">a String, or null</param>
  666. /// <param name="value">a short array object, or null</param>
  667. public void putShortArray(string key, short[] value)
  668. {
  669. unparcel();
  670. mMap.put(key, value);
  671. }
  672. /// <summary>
  673. /// Inserts a char array value into the mapping of this Bundle, replacing
  674. /// any existing value for the given key.
  675. /// </summary>
  676. /// <remarks>
  677. /// Inserts a char array value into the mapping of this Bundle, replacing
  678. /// any existing value for the given key. Either key or value may be null.
  679. /// </remarks>
  680. /// <param name="key">a String, or null</param>
  681. /// <param name="value">a char array object, or null</param>
  682. public void putCharArray(string key, char[] value)
  683. {
  684. unparcel();
  685. mMap.put(key, value);
  686. }
  687. /// <summary>
  688. /// Inserts an int array value into the mapping of this Bundle, replacing
  689. /// any existing value for the given key.
  690. /// </summary>
  691. /// <remarks>
  692. /// Inserts an int array value into the mapping of this Bundle, replacing
  693. /// any existing value for the given key. Either key or value may be null.
  694. /// </remarks>
  695. /// <param name="key">a String, or null</param>
  696. /// <param name="value">an int array object, or null</param>
  697. public void putIntArray(string key, int[] value)
  698. {
  699. unparcel();
  700. mMap.put(key, value);
  701. }
  702. /// <summary>
  703. /// Inserts a long array value into the mapping of this Bundle, replacing
  704. /// any existing value for the given key.
  705. /// </summary>
  706. /// <remarks>
  707. /// Inserts a long array value into the mapping of this Bundle, replacing
  708. /// any existing value for the given key. Either key or value may be null.
  709. /// </remarks>
  710. /// <param name="key">a String, or null</param>
  711. /// <param name="value">a long array object, or null</param>
  712. public void putLongArray(string key, long[] value)
  713. {
  714. unparcel();
  715. mMap.put(key, value);
  716. }
  717. /// <summary>
  718. /// Inserts a float array value into the mapping of this Bundle, replacing
  719. /// any existing value for the given key.
  720. /// </summary>
  721. /// <remarks>
  722. /// Inserts a float array value into the mapping of this Bundle, replacing
  723. /// any existing value for the given key. Either key or value may be null.
  724. /// </remarks>
  725. /// <param name="key">a String, or null</param>
  726. /// <param name="value">a float array object, or null</param>
  727. public void putFloatArray(string key, float[] value)
  728. {
  729. unparcel();
  730. mMap.put(key, value);
  731. }
  732. /// <summary>
  733. /// Inserts a double array value into the mapping of this Bundle, replacing
  734. /// any existing value for the given key.
  735. /// </summary>
  736. /// <remarks>
  737. /// Inserts a double array value into the mapping of this Bundle, replacing
  738. /// any existing value for the given key. Either key or value may be null.
  739. /// </remarks>
  740. /// <param name="key">a String, or null</param>
  741. /// <param name="value">a double array object, or null</param>
  742. public void putDoubleArray(string key, double[] value)
  743. {
  744. unparcel();
  745. mMap.put(key, value);
  746. }
  747. /// <summary>
  748. /// Inserts a String array value into the mapping of this Bundle, replacing
  749. /// any existing value for the given key.
  750. /// </summary>
  751. /// <remarks>
  752. /// Inserts a String array value into the mapping of this Bundle, replacing
  753. /// any existing value for the given key. Either key or value may be null.
  754. /// </remarks>
  755. /// <param name="key">a String, or null</param>
  756. /// <param name="value">a String array object, or null</param>
  757. public void putStringArray(string key, string[] value)
  758. {
  759. unparcel();
  760. mMap.put(key, value);
  761. }
  762. /// <summary>
  763. /// Inserts a CharSequence array value into the mapping of this Bundle, replacing
  764. /// any existing value for the given key.
  765. /// </summary>
  766. /// <remarks>
  767. /// Inserts a CharSequence array value into the mapping of this Bundle, replacing
  768. /// any existing value for the given key. Either key or value may be null.
  769. /// </remarks>
  770. /// <param name="key">a String, or null</param>
  771. /// <param name="value">a CharSequence array object, or null</param>
  772. public void putCharSequenceArray(string key, java.lang.CharSequence[] value)
  773. {
  774. unparcel();
  775. mMap.put(key, value);
  776. }
  777. /// <summary>
  778. /// Inserts a Bundle value into the mapping of this Bundle, replacing
  779. /// any existing value for the given key.
  780. /// </summary>
  781. /// <remarks>
  782. /// Inserts a Bundle value into the mapping of this Bundle, replacing
  783. /// any existing value for the given key. Either key or value may be null.
  784. /// </remarks>
  785. /// <param name="key">a String, or null</param>
  786. /// <param name="value">a Bundle object, or null</param>
  787. public void putBundle(string key, android.os.Bundle value)
  788. {
  789. unparcel();
  790. mMap.put(key, value);
  791. }
  792. /// <summary>
  793. /// Inserts an IBinder value into the mapping of this Bundle, replacing
  794. /// any existing value for the given key.
  795. /// </summary>
  796. /// <remarks>
  797. /// Inserts an IBinder value into the mapping of this Bundle, replacing
  798. /// any existing value for the given key. Either key or value may be null.
  799. /// </remarks>
  800. /// <param name="key">a String, or null</param>
  801. /// <param name="value">an IBinder object, or null</param>
  802. /// <hide></hide>
  803. [System.ObsoleteAttribute]
  804. public void putIBinder(string key, android.os.IBinder value)
  805. {
  806. unparcel();
  807. mMap.put(key, value);
  808. }
  809. /// <summary>
  810. /// Returns the value associated with the given key, or false if
  811. /// no mapping of the desired type exists for the given key.
  812. /// </summary>
  813. /// <remarks>
  814. /// Returns the value associated with the given key, or false if
  815. /// no mapping of the desired type exists for the given key.
  816. /// </remarks>
  817. /// <param name="key">a String</param>
  818. /// <returns>a boolean value</returns>
  819. public bool getBoolean(string key)
  820. {
  821. unparcel();
  822. return getBoolean(key, false);
  823. }
  824. // Log a message if the value was non-null but not of the expected type
  825. private void typeWarning(string key, object value, string className, object defaultValue
  826. , System.InvalidCastException e)
  827. {
  828. java.lang.StringBuilder sb = new java.lang.StringBuilder();
  829. sb.append("Key ");
  830. sb.append(key);
  831. sb.append(" expected ");
  832. sb.append(className);
  833. sb.append(" but value was a ");
  834. sb.append(value.GetType().FullName);
  835. sb.append(". The default value ");
  836. sb.append(defaultValue);
  837. sb.append(" was returned.");
  838. android.util.Log.w(LOG_TAG, sb.ToString());
  839. android.util.Log.w(LOG_TAG, "Attempt to cast generated internal exception:", e);
  840. }
  841. private void typeWarning(string key, object value, string className, System.InvalidCastException
  842. e)
  843. {
  844. typeWarning(key, value, className, "<null>", e);
  845. }
  846. /// <summary>
  847. /// Returns the value associated with the given key, or defaultValue if
  848. /// no mapping of the desired type exists for the given key.
  849. /// </summary>
  850. /// <remarks>
  851. /// Returns the value associated with the given key, or defaultValue if
  852. /// no mapping of the desired type exists for the given key.
  853. /// </remarks>
  854. /// <param name="key">a String</param>
  855. /// <returns>a boolean value</returns>
  856. public bool getBoolean(string key, bool defaultValue)
  857. {
  858. unparcel();
  859. object o = mMap.get(key);
  860. if (o == null)
  861. {
  862. return defaultValue;
  863. }
  864. try
  865. {
  866. return (bool)o;
  867. }
  868. catch (System.InvalidCastException e)
  869. {
  870. typeWarning(key, o, "Boolean", defaultValue, e);
  871. return defaultValue;
  872. }
  873. }
  874. /// <summary>
  875. /// Returns the value associated with the given key, or (byte) 0 if
  876. /// no mapping of the desired type exists for the given key.
  877. /// </summary>
  878. /// <remarks>
  879. /// Returns the value associated with the given key, or (byte) 0 if
  880. /// no mapping of the desired type exists for the given key.
  881. /// </remarks>
  882. /// <param name="key">a String</param>
  883. /// <returns>a byte value</returns>
  884. public byte getByte(string key)
  885. {
  886. unparcel();
  887. return getByte(key, unchecked((byte)0));
  888. }
  889. /// <summary>
  890. /// Returns the value associated with the given key, or defaultValue if
  891. /// no mapping of the desired type exists for the given key.
  892. /// </summary>
  893. /// <remarks>
  894. /// Returns the value associated with the given key, or defaultValue if
  895. /// no mapping of the desired type exists for the given key.
  896. /// </remarks>
  897. /// <param name="key">a String</param>
  898. /// <returns>a byte value</returns>
  899. public byte getByte(string key, byte defaultValue)
  900. {
  901. unparcel();
  902. object o = mMap.get(key);
  903. if (o == null)
  904. {
  905. return defaultValue;
  906. }
  907. try
  908. {
  909. return (byte)o;
  910. }
  911. catch (System.InvalidCastException e)
  912. {
  913. typeWarning(key, o, "Byte", defaultValue, e);
  914. return defaultValue;
  915. }
  916. }
  917. /// <summary>
  918. /// Returns the value associated with the given key, or false if
  919. /// no mapping of the desired type exists for the given key.
  920. /// </summary>
  921. /// <remarks>
  922. /// Returns the value associated with the given key, or false if
  923. /// no mapping of the desired type exists for the given key.
  924. /// </remarks>
  925. /// <param name="key">a String</param>
  926. /// <returns>a char value</returns>
  927. public char getChar(string key)
  928. {
  929. unparcel();
  930. return getChar(key, (char)0);
  931. }
  932. /// <summary>
  933. /// Returns the value associated with the given key, or (char) 0 if
  934. /// no mapping of the desired type exists for the given key.
  935. /// </summary>
  936. /// <remarks>
  937. /// Returns the value associated with the given key, or (char) 0 if
  938. /// no mapping of the desired type exists for the given key.
  939. /// </remarks>
  940. /// <param name="key">a String</param>
  941. /// <returns>a char value</returns>
  942. public char getChar(string key, char defaultValue)
  943. {
  944. unparcel();
  945. object o = mMap.get(key);
  946. if (o == null)
  947. {
  948. return defaultValue;
  949. }
  950. try
  951. {
  952. return (char)(char)o;
  953. }
  954. catch (System.InvalidCastException e)
  955. {
  956. typeWarning(key, o, "Character", defaultValue, e);
  957. return defaultValue;
  958. }
  959. }
  960. /// <summary>
  961. /// Returns the value associated with the given key, or (short) 0 if
  962. /// no mapping of the desired type exists for the given key.
  963. /// </summary>
  964. /// <remarks>
  965. /// Returns the value associated with the given key, or (short) 0 if
  966. /// no mapping of the desired type exists for the given key.
  967. /// </remarks>
  968. /// <param name="key">a String</param>
  969. /// <returns>a short value</returns>
  970. public short getShort(string key)
  971. {
  972. unparcel();
  973. return getShort(key, (short)0);
  974. }
  975. /// <summary>
  976. /// Returns the value associated with the given key, or defaultValue if
  977. /// no mapping of the desired type exists for the given key.
  978. /// </summary>
  979. /// <remarks>
  980. /// Returns the value associated with the given key, or defaultValue if
  981. /// no mapping of the desired type exists for the given key.
  982. /// </remarks>
  983. /// <param name="key">a String</param>
  984. /// <returns>a short value</returns>
  985. public short getShort(string key, short defaultValue)
  986. {
  987. unparcel();
  988. object o = mMap.get(key);
  989. if (o == null)
  990. {
  991. return defaultValue;
  992. }
  993. try
  994. {
  995. return (short)o;
  996. }
  997. catch (System.InvalidCastException e)
  998. {
  999. typeWarning(key, o, "Short", defaultValue, e);
  1000. return defaultValue;
  1001. }
  1002. }
  1003. /// <summary>
  1004. /// Returns the value associated with the given key, or 0 if
  1005. /// no mapping of the desired type exists for the given key.
  1006. /// </summary>
  1007. /// <remarks>
  1008. /// Returns the value associated with the given key, or 0 if
  1009. /// no mapping of the desired type exists for the given key.
  1010. /// </remarks>
  1011. /// <param name="key">a String</param>
  1012. /// <returns>an int value</returns>
  1013. public int getInt(string key)
  1014. {
  1015. unparcel();
  1016. return getInt(key, 0);
  1017. }
  1018. /// <summary>
  1019. /// Returns the value associated with the given key, or defaultValue if
  1020. /// no mapping of the desired type exists for the given key.
  1021. /// </summary>
  1022. /// <remarks>
  1023. /// Returns the value associated with the given key, or defaultValue if
  1024. /// no mapping of the desired type exists for the given key.
  1025. /// </remarks>
  1026. /// <param name="key">a String</param>
  1027. /// <returns>an int value</returns>
  1028. public int getInt(string key, int defaultValue)
  1029. {
  1030. unparcel();
  1031. object o = mMap.get(key);
  1032. if (o == null)
  1033. {
  1034. return defaultValue;
  1035. }
  1036. try
  1037. {
  1038. return (int)o;
  1039. }
  1040. catch (System.InvalidCastException e)
  1041. {
  1042. typeWarning(key, o, "Integer", defaultValue, e);
  1043. return defaultValue;
  1044. }
  1045. }
  1046. /// <summary>
  1047. /// Returns the value associated with the given key, or 0L if
  1048. /// no mapping of the desired type exists for the given key.
  1049. /// </summary>
  1050. /// <remarks>
  1051. /// Returns the value associated with the given key, or 0L if
  1052. /// no mapping of the desired type exists for the given key.
  1053. /// </remarks>
  1054. /// <param name="key">a String</param>
  1055. /// <returns>a long value</returns>
  1056. public long getLong(string key)
  1057. {
  1058. unparcel();
  1059. return getLong(key, 0L);
  1060. }
  1061. /// <summary>
  1062. /// Returns the value associated with the given key, or defaultValue if
  1063. /// no mapping of the desired type exists for the given key.
  1064. /// </summary>
  1065. /// <remarks>
  1066. /// Returns the value associated with the given key, or defaultValue if
  1067. /// no mapping of the desired type exists for the given key.
  1068. /// </remarks>
  1069. /// <param name="key">a String</param>
  1070. /// <returns>a long value</returns>
  1071. public long getLong(string key, long defaultValue)
  1072. {
  1073. unparcel();
  1074. object o = mMap.get(key);
  1075. if (o == null)
  1076. {
  1077. return defaultValue;
  1078. }
  1079. try
  1080. {
  1081. return (long)o;
  1082. }
  1083. catch (System.InvalidCastException e)
  1084. {
  1085. typeWarning(key, o, "Long", defaultValue, e);
  1086. return defaultValue;
  1087. }
  1088. }
  1089. /// <summary>
  1090. /// Returns the value associated with the given key, or 0.0f if
  1091. /// no mapping of the desired type exists for the given key.
  1092. /// </summary>
  1093. /// <remarks>
  1094. /// Returns the value associated with the given key, or 0.0f if
  1095. /// no mapping of the desired type exists for the given key.
  1096. /// </remarks>
  1097. /// <param name="key">a String</param>
  1098. /// <returns>a float value</returns>
  1099. public float getFloat(string key)
  1100. {
  1101. unparcel();
  1102. return getFloat(key, 0.0f);
  1103. }
  1104. /// <summary>
  1105. /// Returns the value associated with the given key, or defaultValue if
  1106. /// no mapping of the desired type exists for the given key.
  1107. /// </summary>
  1108. /// <remarks>
  1109. /// Returns the value associated with the given key, or defaultValue if
  1110. /// no mapping of the desired type exists for the given key.
  1111. /// </remarks>
  1112. /// <param name="key">a String</param>
  1113. /// <returns>a float value</returns>
  1114. public float getFloat(string key, float defaultValue)
  1115. {
  1116. unparcel();
  1117. object o = mMap.get(key);
  1118. if (o == null)
  1119. {
  1120. return defaultValue;
  1121. }
  1122. try
  1123. {
  1124. return (float)o;
  1125. }
  1126. catch (System.InvalidCastException e)
  1127. {
  1128. typeWarning(key, o, "Float", defaultValue, e);
  1129. return defaultValue;
  1130. }
  1131. }
  1132. /// <summary>
  1133. /// Returns the value associated with the given key, or 0.0 if
  1134. /// no mapping of the desired type exists for the given key.
  1135. /// </summary>
  1136. /// <remarks>
  1137. /// Returns the value associated with the given key, or 0.0 if
  1138. /// no mapping of the desired type exists for the given key.
  1139. /// </remarks>
  1140. /// <param name="key">a String</param>
  1141. /// <returns>a double value</returns>
  1142. public double getDouble(string key)
  1143. {
  1144. unparcel();
  1145. return getDouble(key, 0.0);
  1146. }
  1147. /// <summary>
  1148. /// Returns the value associated with the given key, or defaultValue if
  1149. /// no mapping of the desired type exists for the given key.
  1150. /// </summary>
  1151. /// <remarks>
  1152. /// Returns the value associated with the given key, or defaultValue if
  1153. /// no mapping of the desired type exists for the given key.
  1154. /// </remarks>
  1155. /// <param name="key">a String</param>
  1156. /// <returns>a double value</returns>
  1157. public double getDouble(string key, double defaultValue)
  1158. {
  1159. unparcel();
  1160. object o = mMap.get(key);
  1161. if (o == null)
  1162. {
  1163. return defaultValue;
  1164. }
  1165. try
  1166. {
  1167. return (double)o;
  1168. }
  1169. catch (System.InvalidCastException e)
  1170. {
  1171. typeWarning(key, o, "Double", defaultValue, e);
  1172. return defaultValue;
  1173. }
  1174. }
  1175. /// <summary>
  1176. /// Returns the value associated with the given key, or null if
  1177. /// no mapping of the desired type exists for the given key or a null
  1178. /// value is explicitly associated with the key.
  1179. /// </summary>
  1180. /// <remarks>
  1181. /// Returns the value associated with the given key, or null if
  1182. /// no mapping of the desired type exists for the given key or a null
  1183. /// value is explicitly associated with the key.
  1184. /// </remarks>
  1185. /// <param name="key">a String, or null</param>
  1186. /// <returns>a String value, or null</returns>
  1187. public string getString(string key)
  1188. {
  1189. unparcel();
  1190. object o = mMap.get(key);
  1191. if (o == null)
  1192. {
  1193. return null;
  1194. }
  1195. try
  1196. {
  1197. return (string)o;
  1198. }
  1199. catch (System.InvalidCastException e)
  1200. {
  1201. typeWarning(key, o, "String", e);
  1202. return null;
  1203. }
  1204. }
  1205. /// <summary>
  1206. /// Returns the value associated with the given key, or defaultValue if
  1207. /// no mapping of the desired type exists for the given key.
  1208. /// </summary>
  1209. /// <remarks>
  1210. /// Returns the value associated with the given key, or defaultValue if
  1211. /// no mapping of the desired type exists for the given key.
  1212. /// </remarks>
  1213. /// <param name="key">a String, or null</param>
  1214. /// <param name="defaultValue">Value to return if key does not exist</param>
  1215. /// <returns>a String value, or null</returns>
  1216. public string getString(string key, string defaultValue)
  1217. {
  1218. unparcel();
  1219. object o = mMap.get(key);
  1220. if (o == null)
  1221. {
  1222. return defaultValue;
  1223. }
  1224. try
  1225. {
  1226. return (string)o;
  1227. }
  1228. catch (System.InvalidCastException e)
  1229. {
  1230. typeWarning(key, o, "String", e);
  1231. return defaultValue;
  1232. }
  1233. }
  1234. /// <summary>
  1235. /// Returns the value associated with the given key, or null if
  1236. /// no mapping of the desired type exists for the given key or a null
  1237. /// value is explicitly associated with the key.
  1238. /// </summary>
  1239. /// <remarks>
  1240. /// Returns the value associated with the given key, or null if
  1241. /// no mapping of the desired type exists for the given key or a null
  1242. /// value is explicitly associated with the key.
  1243. /// </remarks>
  1244. /// <param name="key">a String, or null</param>
  1245. /// <returns>a CharSequence value, or null</returns>
  1246. public java.lang.CharSequence getCharSequence(string key)
  1247. {
  1248. unparcel();
  1249. object o = mMap.get(key);
  1250. if (o == null)
  1251. {
  1252. return null;
  1253. }
  1254. try
  1255. {
  1256. return (java.lang.CharSequence)o;
  1257. }
  1258. catch (System.InvalidCastException e)
  1259. {
  1260. typeWarning(key, o, "CharSequence", e);
  1261. return null;
  1262. }
  1263. }
  1264. /// <summary>
  1265. /// Returns the value associated with the given key, or defaultValue if
  1266. /// no mapping of the desired type exists for the given key.
  1267. /// </summary>
  1268. /// <remarks>
  1269. /// Returns the value associated with the given key, or defaultValue if
  1270. /// no mapping of the desired type exists for the given key.
  1271. /// </remarks>
  1272. /// <param name="key">a String, or null</param>
  1273. /// <param name="defaultValue">Value to return if key does not exist</param>
  1274. /// <returns>a CharSequence value, or null</returns>
  1275. public java.lang.CharSequence getCharSequence(string key, java.lang.CharSequence
  1276. defaultValue)
  1277. {
  1278. unparcel();
  1279. object o = mMap.get(key);
  1280. if (o == null)
  1281. {
  1282. return defaultValue;
  1283. }
  1284. try
  1285. {
  1286. return (java.lang.CharSequence)o;
  1287. }
  1288. catch (System.InvalidCastException e)
  1289. {
  1290. typeWarning(key, o, "CharSequence", e);
  1291. return defaultValue;
  1292. }
  1293. }
  1294. /// <summary>
  1295. /// Returns the value associated with the given key, or null if
  1296. /// no mapping of the desired type exists for the given key or a null
  1297. /// value is explicitly associated with the key.
  1298. /// </summary>
  1299. /// <remarks>
  1300. /// Returns the value associated with the given key, or null if
  1301. /// no mapping of the desired type exists for the given key or a null
  1302. /// value is explicitly associated with the key.
  1303. /// </remarks>
  1304. /// <param name="key">a String, or null</param>
  1305. /// <returns>a Bundle value, or null</returns>
  1306. public android.os.Bundle getBundle(string key)
  1307. {
  1308. unparcel();
  1309. object o = mMap.get(key);
  1310. if (o == null)
  1311. {
  1312. return null;
  1313. }
  1314. try
  1315. {
  1316. return (android.os.Bundle)o;
  1317. }
  1318. catch (System.InvalidCastException e)
  1319. {
  1320. typeWarning(key, o, "Bundle", e);
  1321. return null;
  1322. }
  1323. }
  1324. /// <summary>
  1325. /// Returns the value associated with the given key, or null if
  1326. /// no mapping of the desired type exists for the given key or a null
  1327. /// value is explicitly associated with the key.
  1328. /// </summary>
  1329. /// <remarks>
  1330. /// Returns the value associated with the given key, or null if
  1331. /// no mapping of the desired type exists for the given key or a null
  1332. /// value is explicitly associated with the key.
  1333. /// </remarks>
  1334. /// <param name="key">a String, or null</param>
  1335. /// <returns>a Parcelable value, or null</returns>
  1336. public T getParcelable<T>(string key) where T:android.os.Parcelable
  1337. {
  1338. unparcel();
  1339. object o = mMap.get(key);
  1340. if (o == null)
  1341. {
  1342. return default(T);
  1343. }
  1344. try
  1345. {
  1346. return (T)o;
  1347. }
  1348. catch (System.InvalidCastException e)
  1349. {
  1350. typeWarning(key, o, "Parcelable", e);
  1351. return default(T);
  1352. }
  1353. }
  1354. /// <summary>
  1355. /// Returns the value associated with the given key, or null if
  1356. /// no mapping of the desired type exists for the given key or a null
  1357. /// value is explicitly associated with the key.
  1358. /// </summary>
  1359. /// <remarks>
  1360. /// Returns the value associated with the given key, or null if
  1361. /// no mapping of the desired type exists for the given key or a null
  1362. /// value is explicitly associated with the key.
  1363. /// </remarks>
  1364. /// <param name="key">a String, or null</param>
  1365. /// <returns>a Parcelable[] value, or null</returns>
  1366. public android.os.Parcelable[] getParcelableArray(string key)
  1367. {
  1368. unparcel();
  1369. object o = mMap.get(key);
  1370. if (o == null)
  1371. {
  1372. return null;
  1373. }
  1374. try
  1375. {
  1376. return (android.os.Parcelable[])o;
  1377. }
  1378. catch (System.InvalidCastException e)
  1379. {
  1380. typeWarning(key, o, "Parcelable[]", e);
  1381. return null;
  1382. }
  1383. }
  1384. /// <summary>
  1385. /// Returns the value associated with the given key, or null if
  1386. /// no mapping of the desired type exists for the given key or a null
  1387. /// value is explicitly associated with the key.
  1388. /// </summary>
  1389. /// <remarks>
  1390. /// Returns the value associated with the given key, or null if
  1391. /// no mapping of the desired type exists for the given key or a null
  1392. /// value is explicitly associated with the key.
  1393. /// </remarks>
  1394. /// <param name="key">a String, or null</param>
  1395. /// <returns>an ArrayList<T> value, or null</returns>
  1396. public java.util.ArrayList<T> getParcelableArrayList<T>(string key) where T:android.os.Parcelable
  1397. {
  1398. unparcel();
  1399. object o = mMap.get(key);
  1400. if (o == null)
  1401. {
  1402. return null;
  1403. }
  1404. try
  1405. {
  1406. return (java.util.ArrayList<T>)o;
  1407. }
  1408. catch (System.InvalidCastException e)
  1409. {
  1410. typeWarning(key, o, "ArrayList", e);
  1411. return null;
  1412. }
  1413. }
  1414. /// <summary>
  1415. /// Returns the value associated with the given key, or null if
  1416. /// no mapping of the desired type exists for the given key or a null
  1417. /// value is explicitly associated with the key.
  1418. /// </summary>
  1419. /// <remarks>
  1420. /// Returns the value associated with the given key, or null if
  1421. /// no mapping of the desired type exists for the given key or a null
  1422. /// value is explicitly associated with the key.
  1423. /// </remarks>
  1424. /// <param name="key">a String, or null</param>
  1425. /// <returns>a Serializable value, or null</returns>
  1426. public java.io.Serializable getSerializable(string key)
  1427. {
  1428. unparcel();
  1429. object o = mMap.get(key);
  1430. if (o == null)
  1431. {
  1432. return null;
  1433. }
  1434. try
  1435. {
  1436. return (java.io.Serializable)o;
  1437. }
  1438. catch (System.InvalidCastException e)
  1439. {
  1440. typeWarning(key, o, "Serializable", e);
  1441. return null;
  1442. }
  1443. }
  1444. /// <summary>
  1445. /// Returns the value associated with the given key, or null if
  1446. /// no mapping of the desired type exists for the given key or a null
  1447. /// value is explicitly associated with the key.
  1448. /// </summary>
  1449. /// <remarks>
  1450. /// Returns the value associated with the given key, or null if
  1451. /// no mapping of the desired type exists for the given key or a null
  1452. /// value is explicitly associated with the key.
  1453. /// </remarks>
  1454. /// <param name="key">a String, or null</param>
  1455. /// <returns>an ArrayList<String> value, or null</returns>
  1456. public java.util.ArrayList<int> getIntegerArrayList(string key)
  1457. {
  1458. unparcel();
  1459. object o = mMap.get(key);
  1460. if (o == null)
  1461. {
  1462. return null;
  1463. }
  1464. try
  1465. {
  1466. return (java.util.ArrayList<int>)o;
  1467. }
  1468. catch (System.InvalidCastException e)
  1469. {
  1470. typeWarning(key, o, "ArrayList<Integer>", e);
  1471. return null;
  1472. }
  1473. }
  1474. /// <summary>
  1475. /// Returns the value associated with the given key, or null if
  1476. /// no mapping of the desired type exists for the given key or a null
  1477. /// value is explicitly associated with the key.
  1478. /// </summary>
  1479. /// <remarks>
  1480. /// Returns the value associated with the given key, or null if
  1481. /// no mapping of the desired type exists for the given key or a null
  1482. /// value is explicitly associated with the key.
  1483. /// </remarks>
  1484. /// <param name="key">a String, or null</param>
  1485. /// <returns>an ArrayList<String> value, or null</returns>
  1486. public java.util.ArrayList<string> getStringArrayList(string key)
  1487. {
  1488. unparcel();
  1489. object o = mMap.get(key);
  1490. if (o == null)
  1491. {
  1492. return null;
  1493. }
  1494. try
  1495. {
  1496. return (java.util.ArrayList<string>)o;
  1497. }
  1498. catch (System.InvalidCastException e)
  1499. {
  1500. typeWarning(key, o, "ArrayList<String>", e);
  1501. return null;
  1502. }
  1503. }
  1504. /// <summary>
  1505. /// Returns the value associated with the given key, or null if
  1506. /// no mapping of the desired type exists for the given key or a null
  1507. /// value is explicitly associated with the key.
  1508. /// </summary>
  1509. /// <remarks>
  1510. /// Returns the value associated with the given key, or null if
  1511. /// no mapping of the desired type exists for the given key or a null
  1512. /// value is explicitly associated with the key.
  1513. /// </remarks>
  1514. /// <param name="key">a String, or null</param>
  1515. /// <returns>an ArrayList<CharSequence> value, or null</returns>
  1516. public java.util.ArrayList<java.lang.CharSequence> getCharSequenceArrayList(string
  1517. key)
  1518. {
  1519. unparcel();
  1520. object o = mMap.get(key);
  1521. if (o == null)
  1522. {
  1523. return null;
  1524. }
  1525. try
  1526. {
  1527. return (java.util.ArrayList<java.lang.CharSequence>)o;
  1528. }
  1529. catch (System.InvalidCastException e)
  1530. {
  1531. typeWarning(key, o, "ArrayList<CharSequence>", e);
  1532. return null;
  1533. }
  1534. }
  1535. /// <summary>
  1536. /// Returns the value associated with the given key, or null if
  1537. /// no mapping of the desired type exists for the given key or a null
  1538. /// value is explicitly associated with the key.
  1539. /// </summary>
  1540. /// <remarks>
  1541. /// Returns the value associated with the given key, or null if
  1542. /// no mapping of the desired type exists for the given key or a null
  1543. /// value is explicitly associated with the key.
  1544. /// </remarks>
  1545. /// <param name="key">a String, or null</param>
  1546. /// <returns>a boolean[] value, or null</returns>
  1547. public bool[] getBooleanArray(string key)
  1548. {
  1549. unparcel();
  1550. object o = m