本文整理汇总了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 ();
}
示例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;
}