本文整理汇总了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;
}
示例2: OnSaveInstanceState
protected override void OnSaveInstanceState (Bundle outState)
{
base.OnSaveInstanceState (outState);
if (mGesture != null)
outState.PutParcelable ("gesture", mGesture);
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
}
示例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;
}
示例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);
}
示例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;
}
示例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 ();
}
}
示例14: OnSaveInstanceState
protected override void OnSaveInstanceState (Bundle outState)
{
base.OnSaveInstanceState (outState);
//save the file path
outState.PutString (FileNameKey, fileName);
outState.PutParcelable ("image", bitmap);
}
示例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);
}
}