本文整理汇总了C#中Bundle.GetFloat方法的典型用法代码示例。如果您正苦于以下问题:C# Bundle.GetFloat方法的具体用法?C# Bundle.GetFloat怎么用?C# Bundle.GetFloat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bundle
的用法示例。
在下文中一共展示了Bundle.GetFloat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCreate
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
SetContentView (Resource.Layout.Sensors);
trackButton = FindViewById<Button> (Resource.Id.trackButton);
stepCount = FindViewById<TextView> (Resource.Id.stepCount);
// create a sensor manager to schedule batches of sensor data
senMgr = (SensorManager) GetSystemService (SensorService);
// update state from orientation change
if (bundle != null)
{
count = bundle.GetFloat ("step_count", 0);
if (bundle.GetBoolean ("visible", false)) {
visible = true;
stepCount.Text = count.ToString ();
}
Log.Debug(GetType().FullName, "Recovered instance state");
}
// This button gets the user's step count since the last time the device was rebooted
trackButton.Click += (o, e) => {
// get the step counter sensor via the SensorManager
counter = senMgr.GetDefaultSensor (SensorType.StepCounter);
// button's been clicked, so counter visibility gets set to true
visible = true;
// This sensor is only available on Nexus 5 and Moto X at time of writing
// The following line will check if the sensor is available explicitly:
bool counterAvailabe = PackageManager.HasSystemFeature(PackageManager.FeatureSensorStepCounter);
Log.Info("SensorManager", "Counter available");
if (counterAvailabe && counter != null) {
// Set sensor delay to normal, the default rate for batching sensor data
senMgr.RegisterListener(this, counter, SensorDelay.Normal);
Toast.MakeText(this,"Count sensor started",ToastLength.Long).Show();
} else {
Toast.MakeText(this, "Count sensor unavailable", ToastLength.Long).Show();
}
};
}
示例2: OnCreate
protected override void OnCreate(Bundle savedInstanceState)
{
powerManager = (PowerManager)GetSystemService(Context.PowerService);
wakeLock = powerManager.NewWakeLock(WakeLockFlags.Partial, "MyWakeLock");
wakeLock.Acquire();
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.Pedometer);
chrono = FindViewById<Chronometer>(Resource.Id.chronometer1);
sensorManager = (SensorManager)GetSystemService(Context.SensorService);
stepsTextView = FindViewById<TextView>(Resource.Id.pedometer);
caloriesTextView = FindViewById<TextView>(Resource.Id.calories);
speedTextView = FindViewById<TextView>(Resource.Id.speed);
distanceTextView = FindViewById<TextView>(Resource.Id.distance);
timeTextView = FindViewById<TextView>(Resource.Id.time);
if (savedInstanceState != null)
{
steps = savedInstanceState.GetInt("steps", 0);
calories = savedInstanceState.GetFloat("calories", 0.0f);
speed = savedInstanceState.GetFloat("speed", 0.0f);
distance = savedInstanceState.GetFloat("distance", 0.0f);
chrono.Base = savedInstanceState.GetLong("time", SystemClock.ElapsedRealtime());
run = savedInstanceState.GetBoolean("run", false);
}
chrono.Format = "00:0%s";
chrono.OnChronometerTickListener = this;
int h = 480;
mYOffset = h * 0.5f;
mScale[0] = -(h * 0.5f * (1.0f / (SensorManager.StandardGravity * 2)));
mScale[1] = -(h * 0.5f * (1.0f / (SensorManager.MagneticFieldEarthMax)));
if (run)
{
refreshTextViews();
sensorsListenerRegister();
chrono.Start();
}
}