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