Android Question Preferences Dialogs

JMB

Active Member
Licensed User
Longtime User
Hi there,

Is it possible to force the Preferences Dialog to use only a large numeric keyboard, rather than the full alphanumeric one?

I have a dialog that only asks for integers, so it would be great to have a nice big numeric keyboard to use.

Thanks for any help.

JMB
 

JMB

Active Member
Licensed User
Longtime User
I think I have configured it for the correct input...

B4X:
Dim input As B4XInputTemplate
   
   input.Initialize
   input.lblTitle.Text = "Enter Data:"
   input.ConfigureForNumbers(False, False)

Is this correct?

JMB
 
Upvote 0

JMB

Active Member
Licensed User
Longtime User
Update:

I ran the example code for the Numeric Input Template and it doesn't show the numeric keyboard...

JMB
 
Upvote 0

JMB

Active Member
Licensed User
Longtime User
Not as far as I am aware....

The code I use to set up the dialog looks like this...

B4X:
       Dim Base As B4XView
   Dim Dialog As B4XDialog
   Dim input As B4XInputTemplate

   Base = Activity
   Dialog.Initialize (Base)
   Dialog.Title = ""
   
   input.Initialize
   input.lblTitle.Text = "Extra Fuel:"
   input.ConfigureForNumbers(False, False)
   input.Text = "100"
   Dialog.Title = "Set Extra Fuel"

   Wait For (Dialog.ShowTemplate(input, "OK", "", "CANCEL")) Complete (Result As Int)
   
   If Result = XUI.DialogResponse_Positive Then
       ExtraFuel= input.Text 'no need to check with IsNumber
   End If
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
This is not "Preferences Dialog". You are using B4XDialog with the input template.

This is how your code looks on a stock Android with the default keyboard:

i_view64_w1yrRD7YUi.png


Note that the dot and comma keys are disabled.

When you set ConfigureForNumbers(False, False) the keyboard input type is set like this:
B4X:
et.InputType = et.INPUT_TYPE_NUMBERS

You can change the input type with:
B4X:
Dim et As EditText = input.TextField
et.InputType = ...
 
  • Like
Reactions: JMB
Upvote 0

JMB

Active Member
Licensed User
Longtime User
Thanks Erel.

Yes, parts of my app are using PreferencesDialog and some are using B4XDialog - I just got a bit confused as to which was which there :)

Howver, I've figured out the problem - I am using SwiftKey as my default keyboard. I switched to the standard keyboard and everything worked as it should.

I guess Swiftkey doesn't provide that facility.

Thanks for your help.

JMB
 
Upvote 0
Top