本文整理汇总了C#中Bundle.ContainsKey方法的典型用法代码示例。如果您正苦于以下问题:C# Bundle.ContainsKey方法的具体用法?C# Bundle.ContainsKey怎么用?C# Bundle.ContainsKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bundle
的用法示例。
在下文中一共展示了Bundle.ContainsKey方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCreate
protected override void OnCreate (Bundle savedInstanceState)
{
base.OnCreate (savedInstanceState);
SetContentView (Resource.Layout.AssignmentsTabsLayout);
tabHost = FindViewById<TabHost> (Resource.Id.assingmentTabHost);
//In order to use tabs outside of a TabActivity I have to use this local activity manager and dispatch create the savedInstanceState
localManger = new LocalActivityManager (this, true);
localManger.DispatchCreate (savedInstanceState);
tabHost.Setup (localManger);
TabHost.TabSpec assignmentsSpec = tabHost.NewTabSpec ("list");
Intent assignmentIntent = new Intent (this, typeof (AssignmentsActivity));
assignmentsSpec.SetContent (assignmentIntent);
assignmentsSpec.SetIndicator ("list");
TabHost.TabSpec mapViewSpec = tabHost.NewTabSpec ("map");
Intent mapViewIntent = new Intent (this, typeof (MapViewActivity));
mapViewSpec.SetContent (mapViewIntent);
mapViewSpec.SetIndicator ("map");
tabHost.AddTab (assignmentsSpec);
tabHost.AddTab (mapViewSpec);
tabHost.TabChanged += (sender, e) => {
if (tabHost.CurrentTab == 0) {
MapData = null;
}
};
try {
if (savedInstanceState != null) {
if (savedInstanceState.ContainsKey (Constants.CurrentTab)) {
var currentTab = savedInstanceState.GetInt (Constants.CurrentTab, 0);
tabHost.CurrentTab = currentTab;
} else {
tabHost.CurrentTab = 0;
}
if (savedInstanceState.ContainsKey ("mapData")) {
MapData = (MapDataWrapper)savedInstanceState.GetSerializable ("mapData");
} else {
MapData = null;
}
} else {
MapData = null;
tabHost.CurrentTab = 0;
}
} catch (Exception) {
tabHost.CurrentTab = 0;
}
}
示例2: OnCreate
protected override void OnCreate(Bundle bundle)
{
RequestWindowFeature(WindowFeatures.NoTitle);
base.OnCreate(bundle);
SetContentView(Resource.Layout.Viewer);
// associate the views
MainImage = FindViewById<ZoomImageView>(Resource.Id.MainImage);
Zoom = FindViewById<ZoomControls>(Resource.Id.ZoomButtons);
OpenButton = FindViewById<ImageButton>(Resource.Id.OpenButton);
LeftButton = FindViewById<ImageButton>(Resource.Id.LeftButton);
RightButton = FindViewById<ImageButton>(Resource.Id.RightButton);
// wire the views
Zoom.ZoomInClick += (src, args) => MainImage.ZoomIn();
Zoom.ZoomOutClick += (src, args) => MainImage.ZoomOut();
OpenButton.Click += (src, args) => OnOpenButtonClick(args);
LeftButton.Click += (src, args) => OnLeftButtonClick(args);
RightButton.Click += (src, args) => OnRightButtonClick(args);
// get preferences
var prefs = GetSharedPreferences("Global", FileCreationMode.Private);
// check bundles and prefs
if (Intent.Extras != null && Intent.Extras.ContainsKey("ComicsPath"))
Controller = new ViewerController(this, Intent.Extras.GetString("ComicsPath"));
else if (bundle != null && bundle.ContainsKey("ComicsPath"))
Controller = new ViewerController(this, bundle.GetString("ComicsPath"));
else
Controller = new ViewerController(this, prefs.GetString("ComicsPath", null));
}
示例3: OnCreate
public override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
if ((savedInstanceState != null) && savedInstanceState.ContainsKey(KeyContent))
_content = savedInstanceState.GetString(KeyContent);
}
示例4: OnCreate
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
currentBaseUrl = "file://android_asset/";
currentUrl = "file:///android_asset/index.html";
if (bundle != null)
{
if (bundle.ContainsKey(UrlKey))
currentUrl = bundle.GetString(UrlKey);
if (bundle.ContainsKey(ConfigKey))
inputConfiguration = JsonSerializer.Deserialize<InputConfiguration>(bundle.GetString(ConfigKey));
}
CheckFirstRun();
LoadUrl();
}
示例5: OnCreate
//@Override
public override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
if ((savedInstanceState != null) && savedInstanceState.ContainsKey(KEY_CONTENT))
{
mContent = savedInstanceState.GetString(KEY_CONTENT);
}
}
示例6: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate (bundle);
SetContentView (Resource.Layout.Main);
// extract authInProgress from bundle if it's in there
if (bundle != null && bundle.ContainsKey ("authInProgress")) {
authInProgress = bundle.GetBoolean ("authInProgress");
}
BuildApiClient ();
}
示例7: UpdateCanSayHello
void UpdateCanSayHello(RestrictionEntry entry, Bundle restrictions)
{
bool canSayHello;
if (restrictions == null || !restrictions.ContainsKey (KEY_CAN_SAY_HELLO))
canSayHello = entry.SelectedState;
else
canSayHello = restrictions.GetBoolean (KEY_CAN_SAY_HELLO);
textSayHello.SetText (canSayHello ? Resource.String.explanation_can_say_hello_true :
Resource.String.explanation_can_say_hello_false);
buttonSayHello.Enabled = canSayHello;
}
示例8: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
Console.WriteLine("OnCreateView from Fragment");
// Why?
base.OnCreateView(inflater, container, savedInstanceState);
// Title saved?
if ((savedInstanceState != null) && savedInstanceState.ContainsKey(KeyContent))
{
Title = savedInstanceState.GetString(KeyContent);
}
// Content
return this.BindingInflate(_resourceId, null);
}
示例9: OnCreateView
public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
if ((savedInstanceState != null) && savedInstanceState.ContainsKey (KEY_CONTENT)) {
mContent = savedInstanceState.GetString (KEY_CONTENT);
}
TextView text = new TextView (Activity);
text.Gravity = GravityFlags.Center;
text.Text = mContent;
text.TextSize = (20 * Resources.DisplayMetrics.Density);
text.SetPadding (20, 20, 20, 20);
LinearLayout layout = new LinearLayout (Activity);
layout.LayoutParameters = new ViewGroup.LayoutParams (ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent);
layout.SetGravity (GravityFlags.Center);
layout.AddView (text);
return layout;
}
示例10: OnCreate
protected override void OnCreate (Bundle savedInstanceState)
{
base.OnCreate (savedInstanceState);
SetContentView (Resource.Layout.main_activity);
mRequestActivityUpdatesButton = FindViewById<Button> (Resource.Id.request_activity_updates_button);
mRemoveActivityUpdatesButton = FindViewById<Button> (Resource.Id.remove_activity_updates_button);
mDetectedActivitiesListView = FindViewById<ListView> (Resource.Id.detected_activities_listview);
mRequestActivityUpdatesButton.Click += RequestActivityUpdatesButtonHandler;
mRemoveActivityUpdatesButton.Click += RemoveActivityUpdatesButtonHandler;
mBroadcastReceiver = new ActivityDetectionBroadcastReceiver ();
mBroadcastReceiver.OnReceiveImpl = (context, intent) => {
var updatedActivities = intent.GetParcelableArrayExtra (Constants.ActivityExtra).Cast<DetectedActivity>().ToList();
UpdateDetectedActivitiesList (updatedActivities);
};
SetButtonsEnabledState ();
if (savedInstanceState != null && savedInstanceState.ContainsKey (
Constants.DetectedActivities)) {
mDetectedActivities = JsonConvert.DeserializeObject<List<DetectedActivity>>(savedInstanceState.GetString (Constants.DetectedActivities));
} else {
mDetectedActivities = new List<DetectedActivity> ();
for (int i = 0; i < Constants.MonitoredActivities.Length; i++) {
mDetectedActivities.Add (new DetectedActivity (Constants.MonitoredActivities [i], 0));
}
}
mAdapter = new DetectedActivitiesAdapter (this, mDetectedActivities);
mDetectedActivitiesListView.Adapter = mAdapter;
buildGoogleApiClient ();
}
示例11: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
if (bundle != null && bundle.ContainsKey(ImagePathKey))
{
_imagePath = bundle.GetString(ImagePathKey);
}
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
var captureImageButton = FindViewById<ImageButton>(Resource.Id.image_button);
captureImageButton.Click += (x, y) =>
{
CaptureImage();
};
DateButton.Text = DateTime.Today.ToShortDateString();
DateButton.Click += (x, y) =>
{
var today = DateTime.Today.Date;
// Create a new instance of DatePickerDialog and return it
var dialog = new DatePickerDialog(this, OnDatePicked, today.Year, today.Month, today.Day);
dialog.Show();
};
var submitButton = FindViewById<Button>(Resource.Id.submit_button);
submitButton.Click += (x, y) =>
{
var progress = ProgressDialog.Show(this, "Processing", "Please Wait...", false);
Task.Factory.StartNew(
() =>
{
var answers = new CustomerComponent().Submit(GetCaptureEntity());
return answers;
})
.ContinueWith(result => OnCompleteAsnycSubmit(result, progress));
progress.Show();
};
}
示例12: OnViewStateRestored
public override void OnViewStateRestored (Bundle savedInstanceState)
{
base.OnViewStateRestored (savedInstanceState);
if (savedInstanceState != null && savedInstanceState.ContainsKey ("previousPosition")) {
var pos = savedInstanceState.GetParcelable ("previousPosition") as CameraPosition;
if (pos != null) {
var update = CameraUpdateFactory.NewCameraPosition (pos);
mapFragment.Map.MoveCamera (update);
}
}
}
示例13: ValidOwnedItems
static bool ValidOwnedItems(Bundle purchased)
{
return purchased.ContainsKey (Response.InAppPurchaseItemList)
&& purchased.ContainsKey (Response.InAppPurchaseDataList)
&& purchased.ContainsKey (Response.InAppDataSignatureList);
}
示例14: OnRestoreInstanceState
protected override void OnRestoreInstanceState(Bundle savedInstanceState)
{
if (savedInstanceState.ContainsKey("selected"))
{
ActionBar.SetSelectedNavigationItem(savedInstanceState.GetInt("selected"));
}
}
示例15: OnActivityCreated
public override void OnActivityCreated(Bundle savedInstanceState)
{
base.OnActivityCreated(savedInstanceState);
if (savedInstanceState != null)
{
if (savedInstanceState.ContainsKey(MONITOR_KEY))
startMonitor = savedInstanceState.GetBoolean(MONITOR_KEY);
if (savedInstanceState.ContainsKey(VOICE_KEY))
switchVoice.Checked = savedInstanceState.GetBoolean(VOICE_KEY);
}
}