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


C# Bundle.GetParcelableArrayList方法代码示例

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


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

示例1: FromBundle

		public static Recipe FromBundle(Bundle bundle) {
			var recipe = new Recipe ();
			recipe.TitleText = bundle.GetString (Constants.RecipeFieldTitle);
			recipe.SummaryText = bundle.GetString (Constants.RecipeFieldSummary);
			recipe.RecipeImage = bundle.GetString (Constants.RecipeFieldImage);
			recipe.IngredientsText = bundle.GetString (Constants.RecipeFieldIngredients);
			var stepBundles = bundle.GetParcelableArrayList (Constants.RecipeFieldSteps);
			if (stepBundles != null) {
				foreach (IParcelable stepBundle in stepBundles) {
					recipe.RecipeSteps.Add (RecipeStep.FromBundle ((Bundle)stepBundle));
				}
			}
			return recipe;
		}
开发者ID:CHANDAN145,项目名称:monodroid-samples,代码行数:14,代码来源:Recipe.cs

示例2: OnViewCreated

		public override void OnViewCreated (View view, Bundle savedInstanceState)
		{
			base.OnViewCreated (view, savedInstanceState);

			currentDirectoryTextView = (TextView)view.FindViewById (Resource.Id.textview_current_directory);
			nothingInDirectoryTextView = (TextView)view.FindViewById (Resource.Id.textview_nothing_in_directory);

			var openPictureButton = (Button)view.FindViewById (Resource.Id.button_open_directory_primary_volume);
			openPictureButton.Click += delegate {
				string selected = directoriesSpinner.SelectedItem.ToString ();
				string directoryName = GetDirectoryName (selected);
				Intent intent = storageManager.PrimaryStorageVolume.CreateAccessIntent (directoryName);
				StartActivityForResult (intent, OPEN_DIRECTORY_REQUEST_CODE);
			};

			// Set onClickListener for the external volumes if exists
			var containerVolumes = (LinearLayout)Activity.FindViewById (Resource.Id.container_volumes);
			foreach (StorageVolume volume in storageManager.StorageVolumes) {
				if (volume.IsPrimary) {
					// Primary volume area is already added
					continue;
				}
				var volumeArea = (LinearLayout)Activity.LayoutInflater.Inflate (
					Resource.Layout.volume_entry, containerVolumes);
				var volumeName = (TextView)volumeArea.FindViewById (Resource.Id.textview_volume_name);
				volumeName.Text = volume.GetDescription (Activity);
				var button = (Button)volumeArea.FindViewById (Resource.Id.button_open_directory);
				button.Click += delegate {
					string selected = directoriesSpinner.SelectedItem.ToString ();
					string directoryName = GetDirectoryName (selected);
					Intent intent = volume.CreateAccessIntent (directoryName);
					StartActivityForResult (intent, OPEN_DIRECTORY_REQUEST_CODE);
				};
			}

			var recyclerView = (RecyclerView)view.FindViewById (Resource.Id.recyclerview_directory_entries);
			if (savedInstanceState != null) {
				directoryEntries = (List<DirectoryEntry>)savedInstanceState.GetParcelableArrayList (DIRECTORY_ENTRIES_KEY);
				currentDirectoryTextView.Text = savedInstanceState.GetString (SELECTED_DIRECTORY_KEY);
				adapter = new DirectoryEntryAdapter (directoryEntries);

				if (adapter.ItemCount == 0)
					nothingInDirectoryTextView.Visibility = ViewStates.Visible;
				
			} else {
				directoryEntries = new List<DirectoryEntry> ();
				adapter = new DirectoryEntryAdapter ();
			}

			recyclerView.SetAdapter (adapter);
			recyclerView.SetLayoutManager (new LinearLayoutManager (Activity));
			directoriesSpinner = (Spinner)view.FindViewById (Resource.Id.spinner_directories);
			var directoriesAdapter = ArrayAdapter.CreateFromResource (Activity, Resource.Array.directories,
																	  Android.Resource.Layout.SimpleSpinnerDropDownItem);
			directoriesSpinner.Adapter = directoriesAdapter;
		}
开发者ID:Appercode,项目名称:monodroid-samples,代码行数:56,代码来源:ScopedDirectoryAccessFragment.cs


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