B4A Class [customview] - Numpad

Erel

Administrator
Staff member
Licensed User

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:



It requires B4A v5.80+.

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

Attachments

Last edited:

Reinaldo

Member
Licensed 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
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:

Erel

Administrator
Staff member
Licensed User
Are you running it on a real device? What is it Android version?
 

Reinaldo

Member
Licensed 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
Hello,

Thanks for this awsome code.

It is possible add the key minus (-)?

Thanks
 

Erel

Administrator
Staff member
Licensed User
It should be simple to add it. Go over the code and the layout. You can add it yourself.
 
  • Like
Reactions: eps

Cebuvi

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

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

Thanks.

Cesar
 

doncx

Member
Licensed 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
 

LucaMs

Expert
Licensed User
Click on spWidth and press F7
I LOVE F7 :p I can not live without it.

[After a compliment to a feature of B4A, it is useful a comment less positive, to not sweeten too much :): given that very useful F7, I think that its internal code should be useful to implement a refactoring feature]
 

doncx

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



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

Active Member
Licensed 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
 

Erel

Administrator
Staff member
Licensed User
It will require modifications to the code in order to add Numpad inside a list.
 
Top