Blackberry input field that mimics the input field of Android - blackberry

I'm trying to make a login screen for Blackberry with input fields for username and password that look like the the editText field of android. Basically, there should be a well defined background and default prompt text in a different color when no text has been input. Unfortunately, I couldn't find a default field provided by blackberry. I'm currently using an EditField and a PasswordEditField with BorderFactory to provide the demarcation. Is anyone aware of such libraries or some other open source efforts by someone to do so? Please point me to any tutorial, etc too.
Thanks!

You will need to write your own custom field which extends EditField.
http://docs.blackberry.com/en/developers/deliverables/11958/Create_a_custom_field_508117_11.jsp
My suggestions are:
Override the Field.paint() method to place the label inside the text box (rather than to the left of it which is the default behaviour). This is where your instruction to the user can go, ie the 'Username' or 'Password' text.
Override the Field.onFocus() method to remove the instruction from the text box. Conversely override the Field.onUnfocus() method to add it back in if the user moves to another text box without entering any text.

Related

Corona sdk text input

I have looked at example code that uses the native textField on Android. I would like to be able to type into the text field without having to touch a button to show the text field, and then touch inside the text field to start typing. Is there a way to show the text field and set focus to it, where I can start typing without touching other buttons. I am working on an app and I don't want the users to have to take extra steps to begin typing text. Thanks for any advice.
You can call native.setKeyboardFocus(yourField) to show the keyboard.
http://docs.coronalabs.com/api/library/native/setKeyboardFocus.html

How to type something else rather than what is typed in EditText in Android

I want to make one application in android where the user is typing in EditText.
But the user does not see what is actualy getting typed, rather it sees a different text in that EditText.
It would be great if you could elaborate on the realtime usage.
However if you want to mask the input, you can use android:inputType="textPassword" in the EditText.
Alternately, you can capture the input using setOnKeyListener and set the value accordingly.

is possible to create a text with click action (like a Action link ) in blackberry mainscreen?

This is seems like a pretty simple question. Is it possible to set a custom action for a text link (those blue texts that are underlined) inside mainscreen in blackberry. In other words, is it possible to have a handler do something on an event like feildchangelistner on the text?
thanks
Yes, the various fields that display text are children of the class field
As you can see from the doc you can override navigationClick, unclick. You may also set the font as one that is underlined and override the default color in paint. You will also need to code touch events if you are supporting the older touchscreen devices (Storms OS5 and below)
I would advise against doing any of this because RIM provide a class that seems to fit your exact needs in the advanced UI pack. Take a look at HyperlinkButtonField

Autocomplete edit field for blackberry jde 4.6

How do I create an auto-complete edit field for blackberry that works on the 4.6 jde?
I know it has to do with a fieldchangelistener and painting a floating rect on the screen, but I haven't succeeded so far.
Sorry for saying such a demotivating thing, however I would even not try to do that. You should realize that simply painting a "floating rect on the screen" is not enough - that "floating rect" shoud be a focusable field that appears over another fields on the screen, however this is impossible with 4.6 APIs.
Say you want to make autocomplete field for Contacts.
Make an object which stores all contact info
Make a CustomAutoCompleteFld class with extends Field.
When this field is clicked its fieldchanged() will get invoked.
Now display a popupScreen with custom width n ht wrt to the records to be shown. This popupScreen is your 'Floating rect'.
The records to be added should themselves be for eg: clickable LabelFields
The records to be displayed depend on your 'Search algo' performed on the obj storing your Contacts info. U'll have to implement your own Search algo.
Now on clicking the record i.e., the labelfld, invoke the fieldChanged of the LabelFld and do further processing

How can I show the numeric virtual keyboard on the Blackberry Storm?

I'm having some difficulty showing the virtual keyboard I want for the Blackberry Storm. I have an option to toggle the keyboard's visibility on a certain screen. Whenever the user types a number, it's handled by the screen, rather than any particular field (there are no textfields on this screen). This much works fine. I can show and hide the keyboard when the user chooses to.
My question is this: How do I make the keyboard that shows up the same as what would appear had the focus been on a BasicEditField with a numeric filter applied, without using a BasicEditField for the input?
I don't think BlackBerry has exposed any APIs to allow for programmatic control over the type of virtual keyboard that is shown. I seem to remember reading about it in the BB forums (although unfortunately I can't find it now).
One thing you could try doing is using a BasicEditField with a numeric field, but place it offscreen so that it isn't visible. When you want to capture numeric input from the user, put focus on that element. I haven't tried this, it's just a thought.

Resources