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


C# Bundle.GetSerializable方法代码示例

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


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

示例1: OnCreate

        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetTheme(PreferenceManager.GetDefaultSharedPreferences(ApplicationContext).GetInt("ThemeStyle", Resource.Style.Theme_Sherlock));

            dbHelper = new NotesDbAdapter(this);
            dbHelper.Open();

            SetContentView(Resource.Layout.NoteEdit);

            scriptureTitle = (TextView)FindViewById(Resource.Id.scriptureTitle);
            scriptureText = (TextView)FindViewById(Resource.Id.scriptureTextContent);
            titleText = (EditText)FindViewById(Resource.Id.title);
            bodyText = (EditText)FindViewById(Resource.Id.body);

            var confirmButton = (Button)FindViewById(Resource.Id.confirm);

            rowId = ((savedInstanceState == null) ? null : savedInstanceState.GetSerializable(NotesDbAdapter.KeyRowId)) as Long;

            if (this.rowId == null)
            {
                var extras = Intent.Extras;
                this.rowId = extras != null ? new Long(extras.GetLong(NotesDbAdapter.KeyRowId)) : null;
            }

            PopulateFields();
            confirmButton.Click += delegate
            {
                SaveState();
                SetResult(Result.Ok);
                Finish();
            };
        }
开发者ID:PablusVinii,项目名称:SuperNWTBible,代码行数:34,代码来源:NoteEditActivity.cs

示例2: OnCreate

        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            this.dbHelper = new NotesDbAdapter(this);
            this.dbHelper.Open();

            SetContentView(Resource.Layout.note_edit);
            SetTitle(Resource.String.edit_note);

            this.titleText = (EditText)FindViewById(Resource.Id.title);
            this.bodyText = (EditText)FindViewById(Resource.Id.body);

            var confirmButton = (Button)FindViewById(Resource.Id.confirm);

            this.rowId = ((savedInstanceState == null) ? null : savedInstanceState.GetSerializable(NotesDbAdapter.KeyRowId)) as Long;

            if (this.rowId == null)
            {
                var extras = Intent.Extras;
                this.rowId = extras != null ? new Long(extras.GetLong(NotesDbAdapter.KeyRowId))
                                        : null;
            }

            this.PopulateFields();
            confirmButton.Click += delegate
                {
                    SetResult(Result.Ok);
                    this.Finish();
                };
        }
开发者ID:89sos98,项目名称:monodroid-samples,代码行数:30,代码来源:NoteEdit.cs

示例3: 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;
            }            
        }
开发者ID:harouny,项目名称:prebuilt-apps,代码行数:52,代码来源:AssignmentTabActivity.cs

示例4: MyButton_OnClick

        public void MyButton_OnClick(View view)
        {
            ((Button)view).Text = "clicked!";

            Console.WriteLine ("Activity1.MyButton_OnClick: Writing into Bundle...");

            Bundle b = new Bundle ();
            var p = Parcel.Obtain ();
            b.PutSerializable ("dummy", new MySerializable ("foo"));
            b.PutParcelable ("dummy2", new MyParcelable ("bar"));
            p.WriteBundle (b);
            p.SetDataPosition (0);

            Console.WriteLine ("Activity1.MyButton_OnClick: Reading from Parcel...");
            var b2 = p.ReadBundle ();
            Console.WriteLine ("Read Bundle: {0}", b2);
            var s  = b.GetSerializable ("dummy");
            Console.WriteLine ("Read Serializable: {0}", s);
            var p2 = b.GetParcelable ("dummy2");
            Console.WriteLine ("Read Parcelable: {0}", p2);
        }
开发者ID:vkheleli,项目名称:monodroid-samples-master,代码行数:21,代码来源:MainActivity.cs

示例5: 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 = ((SerializableDetectedActivities)savedInstanceState.GetSerializable (
					Constants.DetectedActivities)).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 ();
		}
开发者ID:Appercode,项目名称:monodroid-samples,代码行数:36,代码来源:MainActivity.cs


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