当前位置: 首页>>代码示例>>C#>>正文


C# Bundle.PutParcelableArrayList方法代码示例

本文整理汇总了C#中Bundle.PutParcelableArrayList方法的典型用法代码示例。如果您正苦于以下问题:C# Bundle.PutParcelableArrayList方法的具体用法?C# Bundle.PutParcelableArrayList怎么用?C# Bundle.PutParcelableArrayList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Bundle的用法示例。


在下文中一共展示了Bundle.PutParcelableArrayList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateRestrictions

		private void CreateRestrictions (Context context, PendingResult result, Bundle existingRestrictions) 
		{
			// The incoming restrictions bundle contains key/value pairs representing existing app
			// restrictions for this package. In order to retain existing app restrictions, you need to
			// construct new restriction entries and then copy in any existing values for the new keys.
			List <IParcelable> newEntries = InitRestrictions (context);

			// If app restrictions were not previously configured for the package, create the default
			// restrictions entries and return them.
			if (existingRestrictions == null) {
				var extras = new Bundle ();
				extras.PutParcelableArrayList (Intent.ExtraRestrictionsList, newEntries);
				result.SetResult (Result.Ok, null, extras);
				result.Finish ();
				return;
			}

			// Retains current restriction settings by transferring existing restriction entries to
			// new ones.
			foreach (RestrictionEntry entry in newEntries) {
				String key = entry.Key;

				if (KEY_BOOLEAN.Equals (key)) {
					entry.SelectedState = existingRestrictions.GetBoolean (KEY_BOOLEAN);

				} else if (KEY_CHOICE.Equals (key)) {
					if (existingRestrictions.ContainsKey (KEY_CHOICE)) {
						entry.SelectedString = existingRestrictions.GetString (KEY_CHOICE);
					}
			
				} else if (KEY_MULTI_SELECT.Equals (key)) {
					if (existingRestrictions.ContainsKey (KEY_MULTI_SELECT)) {
						entry.SetAllSelectedStrings(existingRestrictions.GetStringArray (key));
					}
				}
			}

			var extra = new Bundle();

			// This path demonstrates the use of a custom app restriction activity instead of standard
			// types.  When a custom activity is set, the standard types will not be available under
			// app restriction settings.
			//
			// If your app has an existing activity for app restriction configuration, you can set it
			// up with the intent here.
			if (PreferenceManager.GetDefaultSharedPreferences (context)
			    .GetBoolean (MainActivity.CUSTOM_CONFIG_KEY, false)) {
				var customIntent = new Intent();
				customIntent.SetClass (context, typeof (CustomRestrictionsActivity));
				extra.PutParcelable (Intent.ExtraRestrictionsIntent, customIntent);
			}

			extra.PutParcelableArrayList (Intent.ExtraRestrictionsList, newEntries);
			result.SetResult (Result.Ok, null, extra);
			result.Finish ();
		}
开发者ID:89sos98,项目名称:monodroid-samples,代码行数:56,代码来源:GetRestrictionsReceiver.cs

示例2: ToBundle

		public Bundle ToBundle()
		{
			var bundle = new Bundle ();
			bundle.PutString (Constants.RecipeFieldTitle, TitleText);
			bundle.PutString (Constants.RecipeFieldSummary, SummaryText);
			bundle.PutString (Constants.RecipeFieldImage, RecipeImage);
			bundle.PutString (Constants.RecipeFieldIngredients, IngredientsText);
			if (RecipeSteps != null) {
				List<IParcelable> stepBundles = new List<IParcelable> (RecipeSteps.Count);
				foreach (RecipeStep recipeStep in RecipeSteps) {
					stepBundles.Add (recipeStep.ToBundle ());
				}
				bundle.PutParcelableArrayList (Constants.RecipeFieldSteps, stepBundles);
			}
			return bundle;
		}
开发者ID:CHANDAN145,项目名称:monodroid-samples,代码行数:16,代码来源:Recipe.cs

示例3: OnSaveInstanceState

		public override void OnSaveInstanceState (Bundle outState)
		{
			base.OnSaveInstanceState (outState);

			outState.PutString (SELECTED_DIRECTORY_KEY, currentDirectoryTextView.Text);
			var entries = new List<IParcelable> (directoryEntries.Count);
			foreach (DirectoryEntry de in directoryEntries)
				entries.Add (de);
			outState.PutParcelableArrayList (DIRECTORY_ENTRIES_KEY, entries);
	 	}
开发者ID:Appercode,项目名称:monodroid-samples,代码行数:10,代码来源:ScopedDirectoryAccessFragment.cs


注:本文中的Bundle.PutParcelableArrayList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。