开发者

Session management on UI in android

In my app, I have to handle the client side session man开发者_JAVA技巧agement regarding UI that means when the user never touches on the screen for a while(eg: 1min), he will be prompted to login screen(in my case). for this I planned like this: added ontouch listener to the root view of every layout and placed my session logic. But the problem is, every layout contains lot of textviews,listviews,buttons,etc. I dont want to add ontouch listener to all these views, for this I added to only root view of my layout. when i touch on textviews, the root view's ontouch listener is getting that touch event and working fine. but when i touch on the remaining views, the root view's ontouch listener is not getting that touch event. Can someone tell me whether my approach is correct or not? If it is correct then how can I do for the remaining views?

thanks,

venu


I don't know, if you're doing it right, but to get notification for all touch events in a parent view you can override the onInterceptTouchEvent(MotionEvent ev) method of the ViewGroup class.

For details check:

http://developer.android.com/reference/android/view/ViewGroup.html#onInterceptTouchEvent(android.view.MotionEvent)

Regards: Ripityom

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜