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


C# Intent.HasExtra方法代码示例

本文整理汇总了C#中Android.Content.Intent.HasExtra方法的典型用法代码示例。如果您正苦于以下问题:C# Intent.HasExtra方法的具体用法?C# Intent.HasExtra怎么用?C# Intent.HasExtra使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Android.Content.Intent的用法示例。


在下文中一共展示了Intent.HasExtra方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: checkMessage

        public void checkMessage(Intent intent)
        {
            if (null != intent)
            {
                if (intent.HasExtra(PushManager.PushReceiveEvent))
                {
                    doOnMessageReceive(intent.Extras.GetString(PushManager.PushReceiveEvent));
                }
                else if (intent.HasExtra(PushManager.RegisterEvent))
                {
                    doOnRegistered(intent.Extras.GetString(PushManager.RegisterEvent));
                }
                else if (intent.HasExtra(PushManager.UnregisterEvent))
                {
                    doOnUnregisteredError(intent.Extras.GetString(PushManager.UnregisterEvent));
                }
                else if (intent.HasExtra(PushManager.RegisterErrorEvent))
                {
                    doOnRegisteredError(intent.Extras.GetString(PushManager.RegisterErrorEvent));
                }
                else if (intent.HasExtra(PushManager.UnregisterErrorEvent))
                {
                    doOnUnregistered(intent.Extras.GetString(PushManager.UnregisterErrorEvent));
                }

                resetIntentValues();
            }
        }
开发者ID:TshepoMokoena,项目名称:pushwoosh-xamarin,代码行数:28,代码来源:MainActivity.cs

示例2: onActivityResult

        private long MAX_FILE_SIZE = 1048576; // 1MB

        #endregion Fields

        #region Methods

        protected void onActivityResult(int requestCode, int resultCode, Intent  data)
        {
            TLog.d(TAG, "onActivityResult called");
            Android.Net.Uri uri = null;
            if(data != null && data.HasExtra("uri"))
                uri = Android.Net.Uri.Parse(data.GetStringExtra("uri"));

            // view new note
            Intent i = new Intent(Intent.ActionView, uri, this, typeof(Tomdroid));
            i.PutExtra("view_note", true);
            i.AddFlags(ActivityFlags.ClearTop);
            StartActivity(i);
            Finish();
        }
开发者ID:decriptor,项目名称:tomdroid,代码行数:20,代码来源:Receive.cs

示例3: OnReceive

        public override void OnReceive(Context context, Intent intent)
        {
            sqlite3_shutdown();
            SqliteConnection.SetConfig(SQLiteConfig.Serialized);
            sqlite3_initialize();

            // If you got a location extra, use it
            Location loc = (Location)intent.GetParcelableExtra(LocationManager.KeyLocationChanged);
            if (loc != null) {
                OnLocationReceived(context, loc);
                return;
            }
            // If you get here, something else has happened
            if (intent.HasExtra(LocationManager.KeyProviderEnabled)) {
                bool enabled = intent.GetBooleanExtra(LocationManager.KeyProviderEnabled, false);
                OnProviderEnabledChanged(context, enabled);
            }
        }
开发者ID:yingfangdu,项目名称:BNR,代码行数:18,代码来源:LocationReceiver.cs

示例4: OnActivityResult

        protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);

            if (RegistroActivity.REQUEST_CODE == requestCode)
            {
                if ((data == null) || (!data.HasExtra(RegistroActivity.LISTA_SELOS)))
                    return;

                arquivo.Selos = WrapperSelo.DesserializarLista(
                    data.GetStringExtra(RegistroActivity.LISTA_SELOS));
                arquivo.Salvar();

                adapter.Selos = arquivo.Selos;
                adapter.NotifyDataSetChanged();

            }
        }
开发者ID:WalissonPires,项目名称:ProjetoKai,代码行数:18,代码来源:MainActivity.cs

示例5: ForwardActivityResult

        /// <summary>
        /// Forwards <c>OnActivityResult</c> to the <c>CardIO</c> plugin. This is a must!
        /// </summary>
        /// <param name="requestCode">Request code</param>
        /// <param name="resultCode">Result code</param>
        /// <param name="data">Intent data</param>
        public static void ForwardActivityResult(int requestCode, Result resultCode, Intent data)
        {
            if (requestCode == ScanActivityResultCode)
            {
                if (data != null && data.HasExtra(CardIOActivity.ExtraScanResult))
                {
                    CreditCard scanResult = (CreditCard)data.GetParcelableExtra(CardIOActivity.ExtraScanResult);
                    
                    _currentScan._result = new CardIOResult
                    {
                        CreditCardType = scanResult.CardType.ToPclCardType(),
                        CardNumber = scanResult.CardNumber,
                        Cvv = scanResult.Cvv,
                        Expiry = new DateTime(scanResult.ExpiryYear, scanResult.ExpiryMonth, 1),
                        PostalCode = scanResult.PostalCode,
                        Success = true
                    };
                }
                else
                    _currentScan._result = new CardIOResult { Success = false };

                _currentScan._finished = true;
            }
        }
开发者ID:TorbenK,项目名称:TK.CardIO,代码行数:30,代码来源:CardIO.cs

示例6: OnActivityResult

        protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
        {
            Kp2aLog.Log("base.onAR");
            base.OnActivityResult(requestCode, resultCode, data);
            if ((requestCode == RequestCodeFileStorageSelectionForPrimarySelect) || ((requestCode == RequestCodeFileStorageSelectionForCopyToWritableLocation)))
            {
                int browseRequestCode = RequestCodeFileBrowseForOpen;
                if (requestCode == RequestCodeFileStorageSelectionForCopyToWritableLocation)
                {
                    browseRequestCode = RequestCodeFileFileBrowseForWritableLocation;
                }

                if (resultCode == ExitFileStorageSelectionOk)
                {

                    string protocolId = data.GetStringExtra("protocolId");

                    if (protocolId == "androidget")
                    {
                        ShowAndroidBrowseDialog(browseRequestCode, false, false);
                    }
                    else if (protocolId == "content")
                    {
                        ShowAndroidBrowseDialog(browseRequestCode, browseRequestCode == RequestCodeFileFileBrowseForWritableLocation, true);
                    }
                    else
                    {
                        bool isForSave = (requestCode == RequestCodeFileStorageSelectionForPrimarySelect) ?
                                             IsStorageSelectionForSave : true;

                        StartSelectFile(isForSave, browseRequestCode, protocolId);

                    }

                }
                else
                {
                    ReturnCancel();
                }

            }

            if ((requestCode == RequestCodeFileBrowseForOpen) || (requestCode == RequestCodeFileFileBrowseForWritableLocation))
            {
                if (resultCode == (Result)FileStorageResults.FileChooserPrepared)
                {
                    IOConnectionInfo ioc = new IOConnectionInfo();
                    SetIoConnectionFromIntent(ioc, data);
                    bool isForSave = (requestCode == RequestCodeFileFileBrowseForWritableLocation) ?
                                         true : IsStorageSelectionForSave;

                    StartFileChooser(ioc.Path, requestCode, isForSave);

                    return;
                }
                if ((resultCode == Result.Canceled) && (data != null) && (data.HasExtra("EXTRA_ERROR_MESSAGE")))
                {
                    ShowToast(data.GetStringExtra("EXTRA_ERROR_MESSAGE"));
                }

                if (resultCode == Result.Ok)
                {
                    Kp2aLog.Log("FileSelection returned "+data.DataString);
                    //TODO: don't try to extract filename if content URI
                    string filename = IntentToFilename(data);
                    Kp2aLog.Log("FileSelection returned filename " + filename);
                    if (filename != null)
                    {
                        if (filename.StartsWith("file://"))
                        {
                            filename = filename.Substring(7);
                            filename = URLDecoder.Decode(filename);
                        }

                        IOConnectionInfo ioc = new IOConnectionInfo
                            {
                                Path = filename
                            };

                        IocSelected(ioc, requestCode);
                    }
                    else
                    {
                        if (data.Data.Scheme == "content")
                        {
                            if ((int) Build.VERSION.SdkInt >= 19)
                            {
                                //try to take persistable permissions
                                try
                                {
                                    Kp2aLog.Log("TakePersistableUriPermission");
                                    var takeFlags = data.Flags
                                            & (ActivityFlags.GrantReadUriPermission
                                            | ActivityFlags.GrantWriteUriPermission);
                                    this.ContentResolver.TakePersistableUriPermission(data.Data, takeFlags);
                                }
                                catch (Exception e)
                                {
                                    Kp2aLog.Log(e.ToString());
                                }
//.........这里部分代码省略.........
开发者ID:pythe,项目名称:wristpass,代码行数:101,代码来源:SelectStorageLocationActivityBase.cs

示例7: GetFilenameFromInternalFileChooser

        public static string GetFilenameFromInternalFileChooser(Intent data, Context ctx)
        {
            #if !EXCLUDE_FILECHOOSER
            string EXTRA_RESULTS = "group.pals.android.lib.ui.filechooser.FileChooserActivity.results";
            if (data.HasExtra(EXTRA_RESULTS))
            {
                IList uris = data.GetParcelableArrayListExtra(EXTRA_RESULTS);
                Uri uri = (Uri) uris[0];
                {
                    return Group.Pals.Android.Lib.UI.Filechooser.Providers.BaseFileProviderUtils.GetRealUri(ctx, uri).ToString();
                }
            }

            #endif
            return null;
        }
开发者ID:pythe,项目名称:wristpass,代码行数:16,代码来源:Util.cs

示例8: OnHandleIntent

        bool OnHandleIntent(Intent intent)
        {
            if (intent != null) {
                if (intent.Action == FinishTripAction)
                    FinishTrip ();
                else if (ActivityRecognitionResult.HasResult (intent))
                    HandleActivityRecognition (intent);
                else if (intent.HasExtra (LocationClient.KeyLocationChanged))
                    HandleLocationUpdate (intent);
            }

            return currentBikingState != BikingState.NotBiking;
        }
开发者ID:nagyist,项目名称:bikr,代码行数:13,代码来源:BikrActivityService.cs

示例9: OnReceive

 public override void OnReceive(Context context, Intent intent)
 {
     if (intent.HasExtra (EXTRA_HIDE_OVERLAYS)) {
         OnHideOverlays (intent.GetBooleanExtra (EXTRA_HIDE_OVERLAYS, false));
     }
 }
开发者ID:vhelias,项目名称:Client_Server,代码行数:6,代码来源:HideOverlaysReceiver.cs

示例10: HandleCommand

 public void HandleCommand(Intent intent)
 {
     if (intent.HasExtra(PING_SERVICE_EXTRA)) {
         PerformPing();
     }
 }
开发者ID:bduncavage,项目名称:evolve2013,代码行数:6,代码来源:DevicePingPluginService.cs

示例11: OnNewIntent

        protected override void OnNewIntent(Intent intent)
        {
            base.OnNewIntent(intent);

            //this method is called from the NfcOtpActivity's startActivity() if the activity is already running
            //note: it's not called in other cases because OnNewIntent requires the activity to be on top already
            //which is never the case when started from another activity (in the same task).
            //NfcOtpActivity sets the ClearTop flag to get OnNewIntent called.
            if ((intent != null) && (intent.HasExtra(Intents.OtpExtraKey)))
            {
                string otp = intent.GetStringExtra(Intents.OtpExtraKey);

                if (this.KeyProviderType == KeyProviders.Otp)
                {
                    _keepPasswordInOnResume = true;

                    if (_otpInfo == null)
                    {
                        //Entering OTPs not yet initialized:
                        _pendingOtps.Add(otp);
                        UpdateKeyProviderUiState();
                    }
                    else
                    {
                        //Entering OTPs is initialized. Write OTP into first empty field:
                        bool foundEmptyField = false;
                        foreach (int otpId in _otpTextViewIds)
                        {
                            EditText otpEdit = FindViewById<EditText>(otpId);
                            if ((otpEdit.Visibility == ViewStates.Visible) && String.IsNullOrEmpty(otpEdit.Text))
                            {
                                otpEdit.Text = otp;
                                foundEmptyField = true;
                                break;
                            }
                        }
                        //did we find a field?
                        if (!foundEmptyField)
                        {
                            Toast.MakeText(this, GetString(Resource.String.otp_discarded_no_space), ToastLength.Long).Show();
                        }
                    }

                    Spinner passwordModeSpinner = FindViewById<Spinner>(Resource.Id.password_mode_spinner);
                    if (passwordModeSpinner.SelectedItemPosition != (int)KeyProviders.Otp)
                    {
                        passwordModeSpinner.SetSelection((int)KeyProviders.Otp);
                    }
                }
                else
                {
                    //assume the key should be used as static password
                    FindViewById<EditText>(Resource.Id.password).Text += otp;
                }

            }
        }
开发者ID:pythe,项目名称:wristpass,代码行数:57,代码来源:PasswordActivity.cs

示例12: onActivityResult

        protected void onActivityResult(int requestCode, int resultCode, Intent  data)
        {
            TLog.d(TAG, "onActivityResult called with result {0}", resultCode);

            // returning from file picker
            if(data != null && data.HasExtra(FilePickerActivity.EXTRA_FILE_PATH)) {
                // Get the file path
                File f = new File(data.GetStringExtra(FilePickerActivity.EXTRA_FILE_PATH));
                Uri noteUri = Uri.FromFile(f);
                Intent intent = new Intent(this, typeof(Receive));
                intent.Data = noteUri;
                StartActivity(intent);
            }
            else { // returning from sync conflict
                SyncService currentService = SyncManager.getInstance().getCurrentService();
                currentService.resolvedConflict(requestCode);
            }
        }
开发者ID:decriptor,项目名称:tomdroid,代码行数:18,代码来源:Tomdroid.cs


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