Skip to content

kpbird/android-global-touchevent

Repository files navigation

Android Detect Global Touch Event

Sidebar and Glovebox Apps become popular overnight because of only one functionality. They provide global menu which can be open from left or right edge of mobile screen. As developer when I show this apps,first thing that comes in my mind was "NDK". Then after I start looking for the solution. Logically I figure out that IF I can detect "Global onTouch Event" then It's posible to display side menu like sidebar or glovebox.

Alt text Alt text Alt text

Problem 1: Detect Global Touch Event Problem 2 : Display Sliding Menu.

Solution For Problem 1:

  1. Create service to detect touch event.
  2. Fetch WindowManager object from system service
  3. Create LinearLayout having 30 px width and fill_parent height
  4. Add LinearLayout to WindowManager
  5. set LinearLayout on left edge of screen / window.

Why I need to Service ? Because we can't get event when activity goes in background or close.

What if I make LinearLayout width more then 30 px ? The control or activity which display in background will not get onTouch event.

About

Android Detect Global Touch Event

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages