5

Using the soft keyboard API's I can get the properties of an android EditText using the following code example

EditorInfo ei = getCurrentInputEditorInfo();
Log.i(TAG, "found field hintText = " + ei.hintText);

but the following code above will not retrieve the hint text if the input field was displayed from a browser.

How do I get the properties of an input field displayed in a browser?

Hichem BOUSSETTA
  • 1,791
  • 1
  • 21
  • 27
DaviesTobi alex
  • 610
  • 1
  • 9
  • 34
  • 1
    by browser do you mean a webview in Android app? as the text view is loaded from an html page and not an activity, the hint property must not be set by default, and this is why it is empty. – Hichem BOUSSETTA Mar 24 '19 at 09:46
  • @HichemBOUSSETTA no ! What I mean is, for example a webpage is loaded in chrome or Firefox on the Android device and you wish to autofill a form on that webpage – DaviesTobi alex Mar 24 '19 at 09:49
  • oh okay, so you are implementing an accessibility android service to autofill the form, correct? – Hichem BOUSSETTA Mar 24 '19 at 09:50
  • @HichemBOUSSETTA no, I actually wanted to use a custom keyboard using the input method service but it has been giving me a headache. So I trying autofill and that also is giving a headache – DaviesTobi alex Mar 24 '19 at 09:53
  • oh yes I see, you would like to know the label or description of the form field that has the focus in order to autofill it. did you manage to get the name / description of the field? maybe easier to obtain than the hint... – Hichem BOUSSETTA Mar 24 '19 at 09:58
  • @HichemBOUSSETTA I am struggling on achieving can you assist with that? – DaviesTobi alex Mar 24 '19 at 10:02
  • I am not sure the custom keyboard can solve the issue. as you can see in this article https://www.tomsguide.com/us/android-o-autofill,review-4602.html password manager apps (dashlane, enpass...) were using accessibility services to achieve autofill. Now, since android Oreo, there is a native api that helps you achieve that, and so autofill would be easier if you target Oreo+ android phone – Hichem BOUSSETTA Mar 24 '19 at 10:12
  • also take a look at this article on enpass website: https://www.enpass.io/android-autofill/ – Hichem BOUSSETTA Mar 24 '19 at 10:13
  • here is the official android documentation of the new autofill framework: https://developer.android.com/guide/topics/text/autofill-services. I invite you to check it and see how you can develop your own service and add your own keyboard if you need it. This is a google sample provided with the documentation: https://github.com/googlesamples/android-AutofillFramework – Hichem BOUSSETTA Mar 24 '19 at 10:25

0 Answers0