HoverTip Android Library

The HoverTip Android library provides an easy way to show simple text message tip when the user long-clicks on or hovers using Samsung S-Pen over a view, similar to what a toast does but the message is associated with a specific view.

A HoverTip provides simple visual feedback about an operation or meaning of a view in a small popup. It only fills the amount of space required for the text message and the current activity remains visible and interactive. HoverTip messages automatically disappear after a timeout.

Installation

To develop an app using HoverTip Android library, you must download the library and import it to your IDE.

Caution: When you add the HoverTip Android library, be sure to add it with resources, as described here. Simply adding a .jar file to your project will not work. You must follow the directions for referencing a library, or your app won't be able to access the library's resources, and it won'y run properly.

Usage

First, instantiate a HoverTip object with one of the makeText() methods. This method takes 3 parameters: the view on which to show a message, the text message, and the duration for the message. It returns a properly initialized HoverTip object, as shown in the following example:

HoverTip hoverTip = HoverTip.makeTip(findViewById(R.id.button, R.string.button_tip, HoverTip.LENGTH_SHORT));

This example demostrates everything you need for most common use cases. You should rarely need anything else. You may, however, want to show HoverTip programmatically, like this:

hoverTip.show();

You must call onPause() method in your activity's onPause() to clean up any resources used by HoverTip:

hoverTip.onPause()

Samsung S-Pen Support

The library automatically checks for the support of Samsung S-Pen on the target platform. If it is supported, both S-Pen and long-click actions will be enabled. Otherwise, only long-clicking on a view will show the text message. So it is safe to use this library on non-Samsung devices.

Built With

Share this project:

Updates