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


C# Bundle.PutParcelable方法代码示例

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


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

示例1: GetAuthToken

 // Getting an authentication token is not supported //throws NetworkErrorException
 public override Bundle GetAuthToken(AccountAuthenticatorResponse response, Account account, string authTokenType, Bundle options)
 {
     var result = new Bundle();
     var am = AccountManager.Get(mContext.ApplicationContext);
     var authToken = am.PeekAuthToken(account, authTokenType);
     if (string.IsNullOrEmpty(authToken))
     {
         var password = am.GetPassword(account);
         if (!string.IsNullOrEmpty(password))
         {
             authToken = AuthTokenLoader.SignIn(mContext, account.Name, password);
         }
     }
     if (!string.IsNullOrEmpty(authToken))
     {
         result.PutString(AccountManager.KeyAccountName, account.Name);
         result.PutString(AccountManager.KeyAccountType, account.Type);
         result.PutString(AccountManager.KeyAuthtoken, authToken);
     }
     else
     {
         var intent = new Intent(mContext, typeof(LoginActivity));
         intent.PutExtra(AccountManager.KeyAccountAuthenticatorResponse, response);
         intent.PutExtra(LoginActivity.EXTRA_TOKEN_TYPE, authTokenType);
         var bundle = new Bundle();
         bundle.PutParcelable(AccountManager.KeyIntent, intent);
     }
     return result;
 }
开发者ID:lsgsk,项目名称:AndroidPatterns,代码行数:30,代码来源:Authenticator.cs

示例2: OnSaveInstanceState

		protected override void OnSaveInstanceState (Bundle outState) 
		{
			base.OnSaveInstanceState (outState);
        
			if (mGesture != null)
				outState.PutParcelable ("gesture", mGesture);
		}
开发者ID:89sos98,项目名称:monodroid-samples,代码行数:7,代码来源:CreateGestureActivity.cs

示例3: Create

 public static SessionDetailFragment Create(Session session)
 {
     var fragment = new SessionDetailFragment();
     var args = new Bundle();
     args.PutParcelable(typeof(Session).Name, Parcels.Wrap(session));
     fragment.Arguments = args;
     return fragment;
 }
开发者ID:nepula-h-okuyama,项目名称:DroidKaigi2016Xamarin,代码行数:8,代码来源:SessionDetailFragment.cs

示例4: NewInstance

 public static SearchedSessionsFragment NewInstance(ISearchGroup searchGroup)
 {
     var fragment = new SearchedSessionsFragment();
     var bundle = new Bundle();
     bundle.PutParcelable(typeof(ISearchGroup).Name, Parcels.Wrap(searchGroup));
     fragment.Arguments = bundle;
     return fragment;
 }
开发者ID:amay077,项目名称:DroidKaigi2016Xamarin,代码行数:8,代码来源:SearchedSessionsFragment.cs

示例5: OnSaveInstanceState

		public override void OnSaveInstanceState (Bundle outState)
		{
			base.OnSaveInstanceState (outState);
			if (resultData != null) {
				outState.PutInt (STATE_RESULT_CODE, resultCode);
				outState.PutParcelable (STATE_RESULT_DATA, resultData);
			}
		}
开发者ID:CHANDAN145,项目名称:monodroid-samples,代码行数:8,代码来源:ScreenCaptureFragment.cs

示例6: AddAccount

 public override Bundle AddAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType, String[] requiredFeatures, Bundle options)
 {
     System.Console.WriteLine ("KiwiAuthenticator-AddAccount");
     Intent intent = new Intent(mContext, typeof(LoginActivity));
     intent.PutExtra("accountType", accountType);
     intent.PutExtra("authTokenType", authTokenType);
     intent.PutExtra("isAddingNewAccount", true);
     intent.PutExtra(AccountManager.KeyAccountAuthenticatorResponse, response);
     Bundle bundle = new Bundle();
     bundle.PutParcelable(AccountManager.KeyIntent, intent);
     return bundle;
 }
开发者ID:ryanerdmann,项目名称:angora,代码行数:12,代码来源:KiwiAuthenticator.cs

示例7: AddAccount

 // Don't add additional accounts //throws NetworkErrorException
 public override Bundle AddAccount(AccountAuthenticatorResponse response, string accountType, string authTokenType, string[] requiredFeatures, Bundle options)
 {
     var intent = new Intent(mContext, typeof(LoginActivity));
     intent.PutExtra(LoginActivity.EXTRA_TOKEN_TYPE, accountType);
     intent.PutExtra(AccountManager.KeyAccountAuthenticatorResponse, response);
     var bundle = new Bundle();
     if (options != null)
     {
         bundle.PutAll(options);
     }
     bundle.PutParcelable(AccountManager.KeyIntent, intent);
     return bundle;
 }
开发者ID:lsgsk,项目名称:AndroidPatterns,代码行数:14,代码来源:Authenticator.cs

示例8: MyButton_OnClick

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

            Bundle b = new Bundle ();
            var p = Parcel.Obtain ();
            b.PutSerializable ("dummy", new MySerializable ());
            b.PutParcelable ("dummy2", new MyParcelable ());
            p.WriteBundle (b);
            p.SetDataPosition (0);
            var b2 = p.ReadBundle ();
            Console.WriteLine (b2);
            var p2 = b.GetParcelable ("dummy2");
            Console.WriteLine (p2);
        }
开发者ID:JesseChang,项目名称:monodroid-samples,代码行数:15,代码来源:MainActivity.cs

示例9: OnItemSelected

        public void OnItemSelected(Android.Net.Uri dateUri)
        {
            if (twoPane) {
                Bundle args = new Bundle ();
                args.PutParcelable (DetailFragment.DETAIL_URI, dateUri);

                DetailFragment fragment = new DetailFragment ();
                fragment.Arguments = args;

                FragmentManager.BeginTransaction ()
                         .Replace (Resource.Id.weather_detail_container, fragment, DETAILFRAGMENT_TAG)
                         .Commit ();
            } else {
                Intent intent = new Intent (this, typeof(DetailActivity))
                             .SetData (dateUri);
                StartActivity (intent);
            }
        }
开发者ID:Screech129,项目名称:WeatherApp,代码行数:18,代码来源:MainActivity.cs

示例10: SaveState

		public override IParcelable SaveState()
		{
			IParcelable p = base.SaveState();
			Bundle bundle = new Bundle();
			bundle.PutParcelable(_stateSuperState, p);

			bundle.PutInt(_statePages, _pages.Size());
			if (0 < _pages.Size())
			{
				for (int i = 0; i < _pages.Size(); i++)
				{
					int position = _pages.KeyAt(i);
					bundle.PutInt(CreateCacheIndex(i), position);
					Fragment f = _pages.Get(position);
					_fm.PutFragment(bundle, CreateCacheKey(position), f);
				}
			}
			return bundle;
		}
开发者ID:Julien-Mialon,项目名称:MaterialViewPager.Xamarin,代码行数:19,代码来源:CacheFragmentStatePagerAdapter.cs

示例11: 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

示例12: IntentToFragmentArgument

        /// <summary>
        /// Intents to fragment argument.
        /// </summary>
        /// <returns>The to fragment argument.</returns>
        /// <param name="intent">Intent.</param>
        public static Bundle IntentToFragmentArgument(Intent intent)
        {
            Bundle arguments = new Bundle();
            if (intent == null)
            {
                return arguments;
            }

            var data = intent.Data;
            if (data != null)
            {
                arguments.PutParcelable("_uri", data);
            }

            var extras = intent.Extras;
            if (extras != null)
            {
                arguments.PutAll(intent.Extras);
            }

            return arguments;
        }
开发者ID:prashantvc,项目名称:XamarinIO,代码行数:27,代码来源:BaseActivity.cs

示例13: OnCreate

        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate (savedInstanceState);
            RequestWindowFeature (WindowFeatures.ActionBar);
            SetContentView (Resource.Layout.activity_detail);
            ActionBar.SetDisplayHomeAsUpEnabled (true);
            ActionBar.SetDisplayShowHomeEnabled (true);
            ActionBar.SetIcon (Resource.Mipmap.ic_launcher);
            ActionBar.Title = "Details";
            if (savedInstanceState == null) {
                Bundle arguments = new Bundle ();
                arguments.PutParcelable (DetailFragment.DETAIL_URI, Intent.Data);

                DetailFragment fragment = new DetailFragment ();
                fragment.Arguments = arguments;

                FragmentTransaction fragTx = this.FragmentManager.BeginTransaction ();

                fragTx.Add (Resource.Id.weather_detail_container, fragment)
                    .Commit ();

            }
        }
开发者ID:Screech129,项目名称:WeatherApp,代码行数:23,代码来源:DetailActivity.cs

示例14: OnSaveInstanceState

		protected override void OnSaveInstanceState (Bundle outState)
		{
			base.OnSaveInstanceState (outState);
			//save the file path
			outState.PutString (FileNameKey, fileName); 
			outState.PutParcelable ("image", bitmap);
		}
开发者ID:mansourb7,项目名称:mobile-samples,代码行数:7,代码来源:PhotoScreen.cs

示例15: OnClientUpdated

 /// <summary>
 /// The on client updated.
 /// </summary>
 /// <param name="clientMessenger">
 /// The client messenger.
 /// </param>
 public void OnClientUpdated(Messenger clientMessenger)
 {
     using (var bundle = new Bundle(1))
     {
         bundle.PutParcelable(ServiceParameters.Messenger, clientMessenger);
         this.Send(ServiceMessages.RequestClientUpdate, bundle);
     }
 }
开发者ID:Anomalous-Software,项目名称:Android.Play.ExpansionLibrary,代码行数:14,代码来源:ServiceMarshaller.cs


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