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


C# Intent.GetAction方法代码示例

本文整理汇总了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");
					}
                }
开发者ID:MahendrenGanesan,项目名称:samples,代码行数:9,代码来源:LocalServiceBroadcaster.cs

示例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");
                }
            }
开发者ID:MahendrenGanesan,项目名称:samples,代码行数:33,代码来源:FragmentReceiveResultSupport.cs

示例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);
                    }
                }
            }
开发者ID:MahendrenGanesan,项目名称:samples,代码行数:27,代码来源:DeviceListActivity.cs


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