Looking for Android number picker (10-key style) - android

I am looking around for a number picker in a 10-key style, ideally as a dialog... but called as an activity is fine too. I want to offer the user an interface that is a little more directed toward entering $ for an invoice amount field. I have seen adjustments to the date and time pickers but they looked awkward for this application. I have also seem someone call the built-in calculator, which would be fine, but I don't know how they were capturing a returned value (if they were). Any ideas? Yes, I can fall back to a regular edit field and the standard android keyboard... I was just hoping for something a little more slick. Thanks!

Have you tried setting the attribute android:numeric on the TextView?
TextView documentation

Related

Live formatting editText with markups/markdown

I have a slight issue. I wanna do something like we have here where we put in format markers such as this and this but I want it to appear in the edit text but not remove the marks for it. At the moment I'm achieving this with a preview button which displays an AlertDialog to show the previewed text.
I'm not sure which code to show as I have no idea how to do this at all. I also have no idea where to start on something like this. I've tried doing tons of research and it formats one word and then completely removes the markup/down for it.
Any help will be appreciated and I'm happy to supply any code whatsoever :)
I achieved this using a third-party library RichEditor and took the ones that I needed. It works really well for what I needed so I would recommend it for people to use.
It uses a webview for the EditText and then converts the text into a WYSIWYG formatting.

Android - call TextWatcher for highlighted text

So I'm new to Android development and I'm currently figuring out TextWatcher.
What I'm attempting to do is attach my TextWatcher listener to an EditText widget and after the user has put in some text, say "Hello" and he highlights "llo" and types in r, I display the change in a TextView widget. For the above example it will display "llo --> r".
Now from what I've read and tried, since the textchangelistener is called every time the user types in something, my code ended up crashing when I ran it on my phone.
Is there a way to call the listener only when the highlighted text is changed so as to avoid calling it every time I'm just typing something in the EditText widget? I hope my question makes sense, I've tried looking around before posting here but I couldn't find anything.
Not looking for code, just some pointers so I can figure out how to do this.
Thanks!
Your best bet would be to use a OnEditorActionListener instead of a textwatcher which I didnt know existed until now. It gets called when there is a change to a textview, and since edit text is a textview than it will work perfectly.
Heres some info on the listener
Btw welcome to the android platform, I think you'll find that it is a rich language and definitely worth learning. If you really want some pointers your main point of reference should be this link which has many guidelines and pointers in the develop tab. Good luck

How to make a custom EditText tool bar?

I am currently trying to make a Writing program. I would like the functionality of an Edit tool bar that contains things such as BOLD, ITALIC, UNDERLINE, etc. I see that it is under Typeface but I'm struggling to figure out how to make it function on just selected text or just for formatting text. I already have the GUI and button listeners in place. Thanks.
There is nothing really built into Android for this, except at a fairly low level. I have the beginnings of a RichEditText custom widget, as a drop-in EditText replacement, but it needs a fair bit of work, which I will get to later in June (I hope I hope I hope).
In a nutshell, you will need to get a Spannable object from your EditText via getText(), then call methods like setSpan() on it to apply your formatting.
Two words my friend, "creative commons". In my experience, mundane pieces of code like date/time pickers, RTF text boxes, etc.. they've all been coded and thought through more thoroughly than you'll ever have the time for. For something like this, don't reinvent the wheel, check out someone else's code, build on it, and check it back in.

Cursor movement and text retrieval in input methods

I'm designing my first Android IME and am a bit overwhelmed. My goals are accessibility-related, and as such I wonder if perhaps I'm trying things with the IME framework that just aren't possible. I've taken the default softkeyboard example and have it working along with some of my modifications, so I've definitely understood at least some of this, but there isn't a whole lot of documentation on some of the things I'm attempting. Here's what I mean:
Currently, Android phones with touchscreen-only keyboards are inaccessible. I currently have an accessible touchscreen keyboard using methods similar to those used in IOS/VoiceOver, so that part of the project is done and fairly straight-forward to accomplish in the IME framework.
Currently, Android's accessibility API doesn't provide accessible feedback for navigating text fields. That is, with an Android screen reader loaded, if you type the word "this", you'll hear individual characters spoken as you type them, but if you then try left-arrowing over the "s", that isn't spoken. So I want to trap movements and provide spoken feedback for the elements navigated past. Here's where I start encountering problems.
I currently have speech feedback for left and right arrowing, using getCurrentInputConnection.getTextBeforeCursor(1, 0) for arrowing left, and a similar call for arrowing right. This gets the character currently under the cursor after the movement is processed, and all is good.
My challenge, though, comes when arrowing up and down between lines. Ideally, I'd like to grab the current line of text and speak that, but I don't see any way to do that. The only thing I can think of is some combination of getTextBefore/AfterCursor(Integer.MAX_VALUE, 0) and combining those values, determining the current line by filtering for the previous and next \n. Is there another way--getting the entire text content of the field as a single block of text and using the cursor position to determine which piece of that text represents the current line? I'm seeing something about extracted text in the various input method classes, and it seems like there may be a way to monitor that, but I don't know if that is at all useful to me (I.e. would that return the entire field content?)
My next goal is providing standard text navigation capabilities. Android accessibility doesn't currently include touchscreen exploration, so it is impossible to otherwise scroll a large block of text. I don't necessarily expect folks to write novels on their phones, but I'd like to provide quick gestures or commands to move up/down paragraphs, and to the top/bottom of longer fields. Does the IMF provide methods for cursor movement, or is that outside of its authority?
Honestly, I didn't get the first part :(
For your second question, you will need to handle it by hand.
For instance, to add a key with a down drawable and make it work you will need to:
In the onKey method check for the code.
If it's 20, you should do a sendDownUpKeyEvents of that key event.

numeric choice field:How to let the user set a value by incrementing/decrementing the displayed value

I have a range say,1-100 and i want the user to select a value from this range.Ofcourse showing this with a spinner will be awful.I want to use the functionality of date widget,where we can pick a date by pressing a +/- sign,the longer the press ,higher the iteration speed.
I found numberpicker.java that has the code the date widget uses to get this functionality, but do i have to paste that entire code to achieve this functionality!
Here is a tutorial on how to pull out NumberPicker; I've followed it myself: http://www.quietlycoding.com/?p=5
I found numberpicker.java that has the
code the date widget uses to get this
functionality, but do i have to paste
that entire code to achieve this
functionality!
Unfortunately, yes, plus perhaps some resources as well (I have not looked at that code recently). I am not aware of anyone who has pulled that out to make a reusable component, and it is not a widget in the SDK.
Sorry!

Categories

Resources