Well I am developing a simple Tip Calculator app as a part of a course and I was faced with the problem that if the user enters an empty text field, how should the error be shown to the user.
I thought of 3 ways:
Show a Dialog stating Bill Amount not specified [Though this is really very lame.]
To show a message in red stating "Bill Amount not specified" and highlighting the text field [Something similar to what it is done on the Web when you do not say enter a username on Gmail].
Use the Animation class to kinda vibrate the text-field in order to show that its not populated.
I was wondering if there are some patterns or good practices which are followed in order to display an error message related to a required field being empty.
Thanks in advance
I've found using Toasts and optionally slight style changes notifies users without being too intrusive. I cannot stand JavaScript popup boxes on websites.
Toast toast = Toast.makeText(this, "Bill amount not specified", Toast.LENGTH_SHORT);
toast.show();
Then animate your box or maybe add/change some red text to guide the user to the correct input box. This way notifies the user without requiring any additional input beyond fixing their mistake (like hitting "OK" on a dialog, etc)
I'd put up an AlertDialog with a "required field blank" message and then, on dismissal of that, set the user input focus to the field in question. (In HTML forms, it's pretty standard to turn the label red, so you could do that too; maybe use a key listener to turn the label back to its original colour when text is entered?)
ETA: or, have a textview with the "required field!" message in above the field but with visibility set to gone by default; then you can just change it to visible/not as needed, which will be a clear visual clue to the user without the annoyance of having to dismiss a dialog.
I'd find the animation thing really annoying. Basically, go with option 2.
Related
I am using DisplayActionSheet method in my Xamarin.Forms application to prompt user with question. I want to add some additional information to question when I prompt user to help with their decision. The problem I'm facing is that my question gets truncated due to its length. It looks like 50 character is the limit for ActionSheet title. Is this the limit of ActionSheet or actually the limit of underlying AlertDialog on Android?
Example of truncated message:
Is it possible to increase the limit of the title? OR is there any other component that I could use in order to display my question. My idea is that since my action required Yes/No answer from user, I could actually use popup body to display my message and then use Ok/Cancel buttons as Yes/No.
While there doesn't seem to be an easy solution for this issue, this thread provides a workaround for exactly your situation.
I am developing an Android application and I need to put a link beside a Text Edit in a form.
The link will pop up a window that holds a tool tip for the user.
EDIT : I want to put some sort of a link beside the text field and, when the user clicks on this link, a pop up window appears and tells him how to fill this text field.
How can I do this in Android ?
Can anyone help me please ?
The "link" can easyly be created by puting a TextView and adding an OnClickListener.
About the "popup":
Have you had a look at Toast-messages? They seem to be doing exactly what you want to do.
Toast toast = Toast.makeText(Context context, String yourMessage, Toast.LENGTH_LONG/SHORT);
toast.show();
If you had, here are some other solutions that could do what you want:
What about a solution with some kind of Dialog? Eg. an AltertDialog could open up, showing the tip, but the User would have to press "OK" to close the "popup".
Another solution, which is also quite ugly would be playing with visibilities. the "popup" would be present allt he time, but only visible if the link is clicked.
How to change visibility of layout programaticly
use android:hint="Your hint" for your EditText to show hint.
Ok I have noticed in the android softkeyboard when the user wants to send a smiley when the user prompts to a insert smiley a list of andriod smileys appear for the user to choose from Ive noticed that beside the smiley is a :) ( it varies depending on mood of smiley) Im thinking the code for that would read
<Key
android:keylabel:=":)"
android:keyOutputText="#drawable/image...." />
Im believing ( correct me if im wrong) if the uses manually types in a :) the drawable image will still appear?? Am I correct or No... Secondly If I add my own emoticons and instead of using the :) I use "*" as the Keylabel and my own image as the drawable outputtext would the user be able to use my emoticon?
Lastly, what if I only want for them to be able to select one of my emoticons to use without seeing the "*"..can I just use the android:KeyoutputText to produce the image or is the android:keylabel acting as a sort of prompt??
First, keyOutputText cannot refer to a drawable. It has to be text, a string.
Your emoticon will not appear in the text box (SMS box, or wherever you are typing) unless it is one of the built in smileys for that app. Otherwise, they'll only see something like this: "=)". To test it, try sending ":-)" in SMS (depending on your SMS app it may or may not show up as an icon) and in a Google search box. I guarantee you that you won't see an icon in the search box.
Note: you'll probably want to have defined android:keyIcon for your keys so they show the icon of the smiley rather than the output text (i.e. "=)", see android:keyOutputText).
To answer your question, if the user manually types in ":)" this is identical to the user pressing a key that has android:keyOutputText=":)".
For the second question, your "emoticon" will actually just end up being a key that sends multiple characters in a row. It saves people from having to type ':','-',')'. Instead they just hit one key and the three characters for their smiley appear.
For the last question, keyOutputText can't produce an image. Only the app that is displaying the text can convert the text to an image. In short, the keyboard is meant for sending and editing text, not icons and images.
Send me an email if you have any more questions: I've been writing a soft keyboard for Android for almost half a year now so I'm pretty familiar with how touch input works.
Pretty new to android so excuse me if this is a really obvious question.
Say my application has a bunch of TextViews, each one showing the attributes of a certain product (name, price, etc). I have a button next to each of these TextViews labeled "modify".
How do I make it so that when I press the modify button next to a certain attribute, a popup window with a space to enter text into comes up so that the user can enter text into this box and then have the actual attribute listing on the original page change? Actually I just need a push in the right direction with creating this popup text field... not sure if there is already some built in functionality for this or if not, what would be the best way to create this kind of thing.
Thanks.
Why not have the modify button set TextEdit.setEnabled(true); and then change focus with TextEdit.setFocus? Note that both of these are inherited from view
If you really want a dialog you might want to looking into the AlertDialog.Builder. I know you can use it with buttons and radio buttons, but I'm not sure you can get it to work with a TextView.
Use a code like this for the input popup: Android dialog input text
In the positive button handler, set your edittext content programmatically like this:
myEditText.setText(value).
As simple as that. The only difference with a standard GUI framework is that you don't retrieve the value as a result of the popup function. Instead, you must provide an action handler.
In the Google Maps app, there's a unique EditText that I'd like to reproduce. If you click "menu" then go to "directions", the "start point" field should begin with "My Location" as the text. The interesting part of this field is its behavior - you cannot edit "My Location" without completely deleting it first.
I have a few places where such behavior would be useful, but I can never quite fully reproduce this. There are three challenges involved with this behavior:
No matter what the user does, they cannot partially edit the field; it is always fully selected.
The keyboard directional keys, rather than moving around the EditText field, change focus.
When the user does choose to change the text, the behavior of #1 and #2 disappear and the field acts like a normal EditText.
Has anyone ever successfully reproduced this behavior?
Isn't it just a hint? Try setting
android:hint="My Location"
on the EditText in your layout resources.