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


C# Bundle.GetStringArray方法代码示例

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


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

		public override View OnCreateView (LayoutInflater inflater, 
		                                   ViewGroup container, Bundle savedInstanceState)
		{
			// Use this to return your custom view for this Fragment
			// return inflater.Inflate(Resource.Layout.YourFragment, container, false);
			var root = inflater.Inflate (Resource.Layout.add_show_gridview_layout, container, false);

			mGridView = root.FindViewById<GridView> (Resource.Id.myGridview);
			setUpAdapter ();

			string buttonText = "I am in position " + position + " with title " + title + " And value " + getGenreValue (title);

			if (savedInstanceState != null) {
				var myNewList = savedInstanceState.GetStringArray ("TrakkedList");
				if (myNewList != null) {
					//mAdapter.setTrakkedShows ((List<string>)savedInstanceState.GetStringArrayList ("TrakkedList"));
					buttonText += "" + myNewList.Length;
				}
			}

			Button b = root.FindViewById<Button> (Resource.Id.bRandomButton);
			b.Text = buttonText;
			b.Click += delegate(object sender, EventArgs e) {
				//mAdapter.NotifyDataSetChanged();
				//Toast.MakeText (this.Activity, "Length of adapter array is "+mAdapter.sizeOfMyShows(), ToastLength.Short).Show ();
				setUpAdapter();
			};


			mGridView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => {
				var intent = new Intent (this.Activity, typeof(ShowDetailsActivity));
				intent.PutExtra ("TVDBID", "" + showsJToken [e.Position] ["id"]);
				StartActivity (intent);


//				Toast.MakeText (this.Activity, "I clicked on position " + e.Position + " with TVDBID of "
//				+ showsJToken [e.Position] ["id"], ToastLength.Short).Show ();
			};

			return root;
		}
开发者ID:robobat,项目名称:Trakker,代码行数:41,代码来源:AddShowsFragment.cs


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