We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Cannot set ReturnType and ReturnCommand

I have a login page with a SfMaskedEdit to get user's phone number and a switch for KeepMeLoggedIn and a login button bellow it.
When the user focuses on SfMaskedEdit on android platform, soft keyboard opens with next button as action key.
If user press the next button on keyboard my app crashes with the following error.

"java.lang.IllegalStateException: focus search returned a view that wasn't able to take focus!"

I looked at the properties of SfMaskedEdit and did not find ReturnType and ReturnCommand properties.
 How can I fix this problem?

5 Replies

DR Dhanasekar R Syncfusion Team January 17, 2019 01:09 PM UTC

Hi Armin, 
 
Greetings from Syncfusion. 
 
We can change the Keyboard of SfMaskEdit with Done button by using custom renderer as mentioned below. 
 
 protected override void OnElementChanged(ElementChangedEventArgs<SfMaskedEdit> e)
        {
            base.OnElementChanged(e);
            Control.ImeOptions = Android.Views.InputMethods.ImeAction.Done;
        }    
 
We have prepared a sample for the same, please download it from the link given below. 
 
Sample linkSfMaskEditSample 
 
Regards, 
Dhanasekar 



AR armin rasoulian January 19, 2019 07:17 AM UTC

Thank you for your help.
But it is much more better if we can set this through SfMaskedEdit control in our XAML file. Just as we do in the Xamarin.Forms Entry.

Thank you so much.


CH Christian January 20, 2019 09:25 AM UTC

Hi, the example has not the event handler named OnElementChanged...


DR Dhanasekar R Syncfusion Team January 21, 2019 11:38 AM UTC

Hi Christian, 
 
The override OnElementChanged code has been included on the CustomRenderer.cs file under MaskEdit.Android project. 
 
File location from the provided project: 
 
 //..../MaskedEdit/MaskedEdit.Android/CustomRenderer.cs 
 
Regards, 
Dhanasekar 



DR Dhanasekar R Syncfusion Team January 21, 2019 11:42 AM UTC

Hi Armin, 
 
Thanks for the update.  
 
We are considering your request “Customize SfMaskedEdit keyboard in XAML as like Entry” and this will be included in any one of our upcoming volume releases. 
 
Regards, 
Dhanasekar 


Loader.
Live Chat Icon For mobile
Up arrow icon