Android : How to put a (Hint) link that pops up a window - android

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.

Related

AutoFill EditText Android

I'm trying to create a search bar like.
I have to use a particular autofill, infact I can't use a dropdowns menu.
For example if I write Noce the edittext will have to suggest Nocera in the same editText, like this.
but if the user write something else the pointer have to the end of the typed text (in this case Noce) and the hint have to disappear.
Is there some library that allows me this?
Thanks for the help.
There's this library that will fulfill some of your requirement called Auto Fill EditText
Finally I have solved this using two EditText in the same position. The first one is a normal editable EditText, the second one is not editable from the user but is used to show the hints programmatically.

How do I add an "edittext" that when you type in a specific word an action happens

How do I add a "edittext" that when you type in a specific word such as "apple" it will make a new xml page pop up. But if the user types in a different word besides "apple" it will make a different xml page pop up.
What I'm trying to accomplish is somethings similar to a logo quiz game where when you type in the right word, a new thing pops up.
I have absolutely no idea how to do it. if u could show me a video on how to do it, that would be very helpful thanks! :)
You should use a TextWatcher to watch for changes and do whatever you want on afterTextChanged().

popup windows in android?

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.

patterns on showing an empty textfield in Android

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.

Edit text view issue

Hi friends
I have an editable text box with a default value like to display to the user like "entername". If the user touches the edit box, I want to clear the value of edittext box and show the virtual keypad to the user, and if the user presses the enter key, only in the edit text box, I have to start another activity. How do I do this?
Hi in android:hint at the type of key pressing only it clear value I want to on touch in edit text box clear value and show virtual keypad to user. How do I do this?
Thanks
What?
I really don't understand what you're asking, but it seems like you might be trying to do a hint? Rather than setting an onTouchEvent listener, add a android:hint="What to do" attribute to your EditText.
U use the following code
EditText EditTextName=findViewById(R.id.EditText01);
((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE)).showSoftInput(EditTextName), 0);
use this code in ontouchListener of EditText
Mohan if I am correct you have two questions here
How to display a hint in an edit box
How get some data from a web service
For the first question you can use android:hint="Enter Name"
For the second one you need to give us more info on what you are trying to do

Categories

Resources