本文整理汇总了C#中Bundle.GetParcelable方法的典型用法代码示例。如果您正苦于以下问题:C# Bundle.GetParcelable方法的具体用法?C# Bundle.GetParcelable怎么用?C# Bundle.GetParcelable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bundle
的用法示例。
在下文中一共展示了Bundle.GetParcelable方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCreate
protected override void OnCreate (Bundle savedInstanceState)
{
base.OnCreate (savedInstanceState);
SetContentView (Resource.Layout.split_street_view_panorama_and_map_demo);
if (savedInstanceState == null)
markerPosition = SYDNEY;
else
markerPosition = savedInstanceState.GetParcelable (MARKER_POSITION_KEY).JavaCast<LatLng> ();
var streetViewPanoramaFragment =
(SupportStreetViewPanoramaFragment)
SupportFragmentManager.FindFragmentById (Resource.Id.streetviewpanorama);
streetViewPanoramaFragment.GetStreetViewPanoramaAsync (this);
SupportMapFragment mapFragment =
(SupportMapFragment) SupportFragmentManager.FindFragmentById (Resource.Id.map);
mapFragment.GetMapAsync (this);
// @Override
// public void onMapReady(GoogleMap map) {
// map.setOnMarkerDragListener(SplitStreetViewPanoramaAndMapDemoActivity.this);
// // Creates a draggable marker. Long press to drag.
// mMarker = map.addMarker(new MarkerOptions()
// .position(markerPosition)
// .icon(BitmapDescriptorFactory.fromResource(R.drawable.pegman))
// .draggable(true));
// }
// });
}
开发者ID:FirstClickStart,项目名称:yesterdaysMuffins,代码行数:31,代码来源:SplitStreetViewPanoramaAndMapDemoActivity.cs
示例2: OnCreate
public override void OnCreate (Bundle savedInstanceState)
{
base.OnCreate (savedInstanceState);
if (savedInstanceState != null) {
resultCode = savedInstanceState.GetInt (STATE_RESULT_CODE);
resultData = (Intent)savedInstanceState.GetParcelable (STATE_RESULT_DATA);
}
}
示例3: OnRestoreInstanceState
protected override void OnRestoreInstanceState (Bundle savedInstanceState)
{
base.OnRestoreInstanceState (savedInstanceState);
mGesture = (Gesture) savedInstanceState.GetParcelable ("gesture");
if (mGesture != null) {
var overlay = (GestureOverlayView) FindViewById (Resource.Id.gestures_overlay);
overlay.Post (() => overlay.Gesture = mGesture);
mDoneButton.Enabled = true;
}
}
示例4: 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);
}
示例5: FragmentArgumentsToIntent
/// <summary>
/// Fragments the arguments to intent.
/// </summary>
/// <returns>The arguments to intent.</returns>
/// <param name="arguments">Arguments.</param>
public static Intent FragmentArgumentsToIntent(Bundle arguments)
{
Intent intent = new Intent();
if (arguments == null)
{
return intent;
}
var data = arguments.GetParcelable("_uri") as Uri;
if (data != null)
{
intent.SetData(data);
}
intent.PutExtras(arguments);
intent.RemoveExtra("_uri");
return intent;
}
示例6: UpdateValuesFromBundle
void UpdateValuesFromBundle (Bundle savedInstanceState)
{
if (savedInstanceState != null) {
if (savedInstanceState.KeySet ().Contains (KEY_REQUESTING_LOCATION_UPDATES)) {
mRequestingLocationUpdates = savedInstanceState.GetBoolean (
KEY_REQUESTING_LOCATION_UPDATES);
}
if (savedInstanceState.KeySet ().Contains (KEY_LOCATION)) {
mCurrentLocation = (Location)savedInstanceState.GetParcelable (KEY_LOCATION);
}
if (savedInstanceState.KeySet ().Contains (KEY_LAST_UPDATED_TIME_STRING)) {
mLastUpdateTime = savedInstanceState.GetString (KEY_LAST_UPDATED_TIME_STRING);
}
UpdateUI ();
}
}
示例7: UpdateValuesFromBundle
void UpdateValuesFromBundle (Bundle savedInstanceState)
{
Log.Info (TAG, "Updating values from bundle");
if (savedInstanceState != null) {
if (savedInstanceState.KeySet ().Contains (REQUESTING_LOCATION_UPDATES_KEY)) {
mRequestingLocationUpdates = savedInstanceState.GetBoolean (REQUESTING_LOCATION_UPDATES_KEY);
SetButtonsEnabledState();
}
if (savedInstanceState.KeySet ().Contains (LOCATION_KEY)) {
mCurrentLocation = (Location)savedInstanceState.GetParcelable (LOCATION_KEY);
}
if (savedInstanceState.KeySet ().Contains (LAST_UPDATED_TIME_STRING_KEY)) {
mLastUpdateTime = savedInstanceState.GetString (LAST_UPDATED_TIME_STRING_KEY);
}
UpdateUI ();
}
}
示例8: 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);
}
示例9: OnCreate
protected override void OnCreate (Bundle savedInstanceState)
{
base.OnCreate (savedInstanceState);
// Set our view from the "main" layout resource
SetContentView (Resource.Layout.PhotoScreen);
photoImageView = FindViewById<ImageView> (Resource.Id.photoImageView);
locationText = FindViewById<TextView> (Resource.Id.locationText);
facebookButton = FindViewById<Button> (Resource.Id.facebookButton);
flickrButton = FindViewById<Button> (Resource.Id.flickrButton);
twitterButton = FindViewById<Button> (Resource.Id.twitterButton);
appnetButton = FindViewById<Button> (Resource.Id.appnetButton);
facebookButton.Click += ShareFacebook_Click;
flickrButton.Click += ShareFlickr_Click;
twitterButton.Click += ShareTwitter_Click;
appnetButton.Click += ShareAppnet_Click;
//if reuse Bitmap if present
fileName = savedInstanceState == null ? string.Empty : savedInstanceState.GetString (FileNameKey, string.Empty);
bitmap = savedInstanceState == null ? null : (Bitmap) savedInstanceState.GetParcelable ("image");
}
示例10: 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);
}
}
}
示例11: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
if (Arguments != null)
{
site = Arguments.GetString("baseUrl", "http://smartreporter.altervista.org/");
}
searching = false;
loadedSite = "http://smartreporter.altervista.org/";
var rootView = inflater.Inflate(Resource.Layout.list_fragment, container, false);
if (savedInstanceState != null)
{
IParcelable savedRecyclerLayoutState = (IParcelable)savedInstanceState.GetParcelable("recycler_layout");
listViewNews.GetLayoutManager().OnRestoreInstanceState(savedRecyclerLayoutState);
}
pbNews = rootView.FindViewById<RelativeLayout>(Resource.Id.pbNews);
listViewNews = rootView.FindViewById<RecyclerView>(Resource.Id.list_news);
emptyView = rootView.FindViewById<TextView>(Resource.Id.empty_view);
//Setup layout manager
PreCachingLayoutManager mLayoutManager = new PreCachingLayoutManager(Application.Context);
mLayoutManager.Orientation = LinearLayoutManager.Vertical;
mLayoutManager.SetExtraLayoutSpace(GetScreenHeight(Activity));
listViewNews.SetLayoutManager(mLayoutManager);
listViewNews.AddOnScrollListener(new mOnScrollListener(this));
refresher = rootView.FindViewById<SwipeRefreshLayout>(Resource.Id.refresher);
refresher.SetColorSchemeResources(Resource.Color.orange, Resource.Color.green, Resource.Color.blue);
refresher.Refresh += (sender, e) =>
{
pbNews.Visibility = ViewStates.Visible;
load(site + "feed", true);
page = 1;
detecting = true;
};
load(site + "feed", false);
return rootView;
}