本文整理汇总了C#中Android.Content.Intent.GetAction方法的典型用法代码示例。如果您正苦于以下问题:C# Intent.GetAction方法的具体用法?C# Intent.GetAction怎么用?C# Intent.GetAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Content.Intent
的用法示例。
在下文中一共展示了Intent.GetAction方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnReceive
public override void OnReceive(Context context, Intent intent) {
if (intent.GetAction().Equals(ACTION_STARTED)) {
callbackData.SetText("STARTED");
} else if (intent.GetAction().Equals(ACTION_UPDATE)) {
callbackData.SetText("Got update: " + intent.GetIntExtra("value", 0));
} else if (intent.GetAction().Equals(ACTION_STOPPED)) {
callbackData.SetText("STOPPED");
}
}
示例2: OnActivityResult
/**
* This method is called when the sending activity has Finished, with the
* result it supplied.
*/
public override void OnActivityResult(int requestCode, int resultCode, Intent data) {
// You can use the requestCode to select between multiple child
// activities you may have started. Here there is only one thing
// we launch.
if (requestCode == GET_CODE) {
// We will be Adding to our text.
IEditable text = (IEditable)mResults.GetText();
// This is a standard resultCode that is sent back if the
// activity doesn't supply an explicit result. It will also
// be returned if the activity failed to launch.
if (resultCode == RESULT_CANCELED) {
text.Append("(cancelled)");
// Our protocol with the sending activity is that it will send
// text in 'data' as its result.
} else {
text.Append("(okay ");
text.Append(int.ToString(resultCode));
text.Append(") ");
if (data != null) {
text.Append(data.GetAction());
}
}
text.Append("\n");
}
}
示例3: OnReceive
public override void OnReceive(Context context, Intent intent)
{
String action = intent.GetAction();
// When discovery finds a device
if (BluetoothDevice.ACTION_FOUND.Equals(action))
{
// Get the BluetoothDevice object from the Intent
BluetoothDevice device = intent.GetParcelableExtra<BluetoothDevice>(BluetoothDevice.EXTRA_DEVICE);
// If it's already paired, skip it, because it's been listed already
if (device.GetBondState() != BluetoothDevice.BOND_BONDED)
{
activity.mNewDevicesArrayAdapter.Add(device.GetName() + "\n" + device.GetAddress());
}
// When discovery is finished, change the Activity title
}
else if (BluetoothAdapter.ACTION_DISCOVERY_FINISHED.Equals(action))
{
activity.SetProgressBarIndeterminateVisibility(false);
activity.SetTitle(R.Strings.select_device);
if (activity.mNewDevicesArrayAdapter.GetCount() == 0)
{
var noDevices = activity.GetResources().GetText(R.Strings.none_found).ToString();
activity.mNewDevicesArrayAdapter.Add(noDevices);
}
}
}