B4A Class [customview] - Numpad


The numpad custom view is made of an EditText, or more accurately a FloatLabeledEditText. When the user clicks on the text field, the numpad appears instead of the standard keyboard.

The advantage of the numpad is that it appears near the text field and that you can further customize it as needed.

Note that it depends on ViewsEx v1.11+: https://www.b4x.com/android/forum/threads/updates-to-internal-libraries.59340/#post-406191 (make sure to copy it to the internal libraries folder).

As it is implemented as a custom view, you should add the Numpad class to your project with Numpad.bal layout file and then add one or more Numpads with the designer.
You can configure it from the designer:

SS-2016-03-02_13.34.13.png


It requires B4A v5.80+.

B4i implementation of this view: https://www.b4x.com/android/forum/threads/customview-numpad.64201/
 

Attachments

  • Numpad.zip
    10.9 KB · Views: 1,521
Last edited:

Reinaldo

Member
Licensed User
Longtime User
Hello, i am try test this numpad sample and when i click on any number show this:
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
java.lang.NoClassDefFoundError: android.animation.AnimatorSet
at com.wrapp.floatlabelededittext.FloatLabeledEditText.setShowHint(FloatLabeledEditText.java:161)
at com.wrapp.floatlabelededittext.FloatLabeledEditText.access$0(FloatLabeledEditText.java:153)
at com.wrapp.floatlabelededittext.FloatLabeledEditText$1.afterTextChanged(FloatLabeledEditText.java:116)
at android.widget.TextView.sendAfterTextChanged(TextView.java:6145)
at android.widget.TextView$ChangeWatcher.afterTextChanged(TextView.java:6328)
at android.text.SpannableStringBuilder.sendTextHasChanged(SpannableStringBuilder.java:897)
at android.text.SpannableStringBuilder.change(SpannableStringBuilder.java:353)
at android.text.SpannableStringBuilder.change(SpannableStringBuilder.java:269)
at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:432)
at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:409)
at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:28)
at android.text.method.QwertyKeyListener.onKeyDown(QwertyKeyListener.java:195)
at android.text.method.TextKeyListener.onKeyDown(TextKeyListener.java:132)
at android.widget.TextView.doKeyDown(TextView.java:4304)
at android.widget.TextView.onKeyDown(TextView.java:4149)
at android.view.KeyEvent.dispatch(KeyEvent.java:1037)
at android.view.View.dispatchKeyEvent(View.java:3740)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:788)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:788)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:788)

thanks for your help
 

Reinaldo

Member
Licensed User
Longtime User
I found that the bug is with floatlabelededittext custom view, i add a floatlabelededittext to activity, but when press any key show this error:

** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
java.lang.NoClassDefFoundError: android.animation.AnimatorSet
at com.wrapp.floatlabelededittext.FloatLabeledEditText.setShowHint(FloatLabeledEditText.java:161)
at com.wrapp.floatlabelededittext.FloatLabeledEditText.access$0(FloatLabeledEditText.java:153)
at com.wrapp.floatlabelededittext.FloatLabeledEditText$1.afterTextChanged(FloatLabeledEditText.java:116)
at android.widget.TextView.sendAfterTextChanged(TextView.java:6145)
at android.widget.TextView$ChangeWatcher.afterTextChanged(TextView.java:6328)
at android.text.SpannableStringBuilder.sendTextHasChanged(SpannableStringBuilder.java:897)
at android.text.SpannableStringBuilder.change(SpannableStringBuilder.java:353)
at android.text.SpannableStringBuilder.change(SpannableStringBuilder.java:269)
at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:432)
at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:409)
at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:28)
at android.view.inputmethod.BaseInputConnection.replaceText(BaseInputConnection.java:583)
at android.view.inputmethod.BaseInputConnection.commitText(BaseInputConnection.java:174)
at com.android.internal.widget.EditableInputConnection.commitText(EditableInputConnection.java:120)
at com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:247)
at com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:73)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)

I have ViewsEx 1.10 into libraries folder...thank for your help.
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User

Reinaldo

Member
Licensed User
Longtime User
Thanks for your reply Erel and Don, the problem is the android release, i was running the 2.2 and this library require Android 4.+.
 

Cebuvi

Active Member
Licensed User
Longtime User
Hello,

Thanks for this awsome code.

It is possible add the key minus (-)?

Thanks
 

Cebuvi

Active Member
Licensed User
Longtime User
Thank you very much Erel, tried and resolved.

Another problem is that I can not display the symbol DEL.

Thanks.

Cesar
 

doncx

Active Member
Licensed User
Longtime User
I have been trying to enlarge the numpad to fill most of the screen but can't figure out how that can be done.

Where to spWidth and spHeight come from? I've looked through various sources and can't seem to find it - must be missing something.

Could you give me some insight as to where the sizing comes from?

Thank you
 

doncx

Active Member
Licensed User
Longtime User
Click on spWidth and press F7. You will immediately see where they are set:

SS-2016-09-26_17.18.53.png


You will also need to update the numpad layout file.

Thank you Erel. That code may have been collapsed - not sure how I didn't see it. I'm new to custom views and looking forward to wrapping my head around this.
 

Lello1964

Well-Known Member
Licensed User
Longtime User
Hello,
i have to use this Numad in UltimateListView, when i click in a cell editable, i want insert numeric value with Numpad. How can i use it without designer in Edit_RowLayoutCreator ?
Thanks
 

ivan.tellez

Active Member
Licensed User
Longtime User
Is there a way to receive the back key in the instances of this control to close the keyboard instead of closing the page?
 
Top