Program Resource

Resource libraries for programmers and developers

Go back and forth in WebView history with finger gesture

It is easy to add Web functionality to Android app using WebView. It is hard to customize contents shown inside webview, but you can customize UIs. This time, I’m going to show how to use gesture, swiping finger left / right to go back / forward in webview history. GestureDetector class is used for gesture processing. By using this class, not only left / right swipe but also double tap or long hold can be assigned to some functions. Be careful not to override too much of  browser functions. Use WebView class as base, and create custom WebView class to handle gesture. In sample code below, swiping finger left to …