Im writing an app with voice activated buttons. I would like the buttons on screen, when long-pressed to pop a toast next to the button giving the voice command the app will recognize (kind of like a tooltip). The toast should appear next to the button and last only as long as the button is held.
Questions:
*How to set Toast length to custom (long-click duration) time
*How to change position of toast to be closer to button clicked
I think what you are looking for is
http://developer.android.com/reference/android/view/View.OnLongClickListener.html
Set an OnLongClickListener to launch a Toast.
http://developer.android.com/reference/android/widget/Toast.html
Edit
For setting the length of the toast only the values of LENGTH_SHORT and LENGTH_LONG may be use. This is because these are flags specified for that class. The only solution to create a longer toast would probably be to launch the toast multiple times.
For setting the position of the Toast you can set the Gravity of the toast and specify an offset. You could set the position to Top Left and use the view’s position to compute the offset for your tooltip.