30

Samsung has done something great with the hovering API, and I'm interested in including it in my app. The problem is that the hovering API included in the SPen SDK only work with the SPen and not with the finger detection like the latest apps do on the Samsung Galaxy S4.

Can anyone provide me with a link to the right SDK or even a sample project?

EDIT: Nifhel commented, fallow this link: Floating Touch on Galaxy S4 (requires API 12 and to create a new class that inherit from TextView for instance)

EDIT: The accepted answer is a better solution and works perfectly well (requires API 14 but easier to use).

NG_
  • 6,895
  • 7
  • 45
  • 67
Stephane Mathis
  • 6,542
  • 6
  • 43
  • 69

3 Answers3

20

I've tried out the method described on the link recommended by Nifhel. The only thing you have to do is adding a new intent filter for your Activity in the manifest, no need to override "dispatchGenericMotionEvent":

<intent-filter>
    <action android:name="com.sec.android.airview.HOVER" />
</intent-filter>

After that you have to add an onHoverListener to you View and it will work fine. For example in my ListAdapter:

convertView.setOnHoverListener(new OnHoverListener() {
    @Override
    public boolean onHover(View v, MotionEvent event) {
        Log.d("ListAdapter", "Hover: " + item);
        return false;
    }
});
Siz
  • 316
  • 1
  • 5
  • Hi. This solution works well if you're not starting activity in new process. Do you know how to enable floating touch when activity started in new process? – Aram Jun 18 '13 at 14:11
-1

Based on what I could find, Samsung is yet to release an API that supports finger hovering (AirView).

Akash
  • 631
  • 1
  • 8
  • 16
-4

Try ApiDemos in latest version of sdk android-17 (4.2.2) -> Views -> Hover.class. It can give you a heads up on Hover event.

sb_269
  • 553
  • 2
  • 7
  • 22
  • This Demo demonstrates how to use onHover listener, which works for a mouse or touchpad. Not even close to what I'm looking for. – Stephane Mathis May 03 '13 at 15:42