Bug 21862 - Software keyboard does not show up when we set Focus for Entry in Android
Summary: Software keyboard does not show up when we set Focus for Entry in Android
Status: VERIFIED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.2.2
Hardware: PC Mac OS
: Normal normal
Target Milestone: 1.3.4
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-08-06 05:12 UTC by Prashant Cholachagudda
Modified: 2015-10-07 12:13 UTC (History)
18 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description Prashant Cholachagudda 2014-08-06 05:12:50 UTC
Unlike iOS, in Android Software keyboard does not show up when we set focus from code.

Xamarin.Forms v1.2.2.6243

Sapmple code:

public class App
{
	public static Page GetMainPage ()
	{	
		var entry = new Entry {
			WidthRequest = 300
		};

		var button = new Button { 
			Text = "Click"
		};

		button.Clicked += (sender, e) => entry.Focus ();
		 
		return new ContentPage { 
			Content = new StackLayout {
				Children = { entry, button },
				VerticalOptions = LayoutOptions.CenterAndExpand,
				HorizontalOptions = LayoutOptions.CenterAndExpand,
			},
		};
	}
}
Comment 2 christoph.rehmann 2014-09-29 02:50:30 UTC
With the current Xamarin.Forms 1.2.3 Prerelease 4, this problem seems to be fixed when using an entry. However it is still not solved when using an editor control.
Comment 3 Prashant Mothukuri 2014-10-16 04:45:11 UTC
Not working with SearchBar too.
Comment 4 Jason Smith [MSFT] 2015-01-18 04:10:30 UTC
Will verify those two controls, thank you
Comment 5 Jason Smith [MSFT] 2015-02-06 08:52:43 UTC
Should be fixed in 1.3.4-pre1
Comment 6 Ram Chandra 2015-02-11 04:09:15 UTC
I have checked this issue with following build:

Xmarin.Forms: 1.3.4.6328-pre2
Mac OS X 10.10.0
Xamarin Studio : 5.7.1 (build 17)
Mono 3.12.0 ((detached/a813491)
GTK+ 2.24.23 (Raleigh theme)
Package version: 312000068
Xamarin.Android: 4.20.0.28 (Business Edition)
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
=== Build Information ===
Release ID: 507010017
Git revision: 0bc7d3550b6b088ac25b08dcf7bbe73bcc8658b3
Build date: 2015-02-03 19:43:29-05
Xamarin addins: f7b7d34419c9ec24501bfa7c658e80a6305613e0

Observation: I have checked this issue for both entry and editor control and observed that software keyboard shows up when we set Focus for Entry in Android.

This issue has been fixed. Hence I am closing this issue.
Comment 7 Michiel van Vlaardingen 2015-02-25 09:55:31 UTC
I can confirm it works if you are just setting focus to an Entry/Editor, however it does not seem to work in case there is already a keyboard showing at the time Focus() is called.  Specifically  setting Focus() to another Entry from the Completed handler of a currently focussed one:

emailEntry.Completed += (object sender, EventArgs e) => {
	passwordEntry.Focus();
};

will put focus on passwordEntry, but still hide the keyboard.
Comment 8 Fokke Vermeulen 2015-03-05 06:24:46 UTC
For me it's not working with the searchbar
Comment 9 matthew.thomas 2015-10-07 12:13:56 UTC
We are seeing that this bug is still a problem on Xamarin.Forms 1.4.4