Questions tagged [android-event]

On Android, there's more than one way to intercept the events from a user's interaction with your application. When considering events within your user interface, the approach is to capture the events from the specific View object that the user interacts with. The View class provides the means to do so. Questions that regard doubt about any type of events action (listeners and handlers), should use this tag to express themselves.

Within the various View classes that you'll use to compose your layout, you may notice several public callback methods that look useful for UI events. These methods are called by the Android framework when the respective action occurs on that object. For instance, when a View (such as a Button) is touched, the onTouchEvent() method is called on that object. However, in order to intercept this, you must extend the class and override the method. However, extending every View object in order to handle such an event would not be practical. This is why the View class also contains a collection of nested interfaces with callbacks that you can much more easily define. These interfaces, called event listeners, are your ticket to capturing the user interaction with your UI.

While you will more commonly use the event listeners to listen for user interaction, there may come a time when you do want to extend a View class, in order to build a custom component. Perhaps you want to extend the Button class to make something more fancy. In this case, you'll be able to define the default event behaviors for your class using the class event handlers.

For a more detailed information you can visit Google oficial webpage about Events at Google Developer - Events

318 questions
0
votes
1 answer

How can I detect a fling gesture when there are widgets involved?

Background: I'm trying to detect edge swipes in my app (to bring up a menu), and searching stackoverflow seems to indicate that the way to detect swipes is to start with fling detection. I'm trying to detect a fling event in my app. I can override…
Edward Falk
  • 9,991
  • 11
  • 77
  • 112
0
votes
4 answers

Trigger onClick on current position of Button/ImageView animated with XML

I am making a simple game that displays balloons (Button/ImageView with background pic of a balloon). I've animated the balloons using the anim.xml files and the balloons move pretty well around the screen. The problem is that when you touch them,…
0
votes
1 answer

onAccessibityEvent not called in Android

i tried to get some tutorials on accessibility events. and i found one accessibility tutorial. it is good & i implemented in eclipse & running in my tablet 5.1.1, nexus. Coding. MyAccessibilityService.java public class MyAccessibilityService…
user3546693
  • 364
  • 3
  • 18
0
votes
1 answer

The onTouchEvent is not being called

I am making a game app that displays random circles all across the screen. This is all done in the onDraw method by making a never ending loop. However in the onTouchEvent method there is code that is called when a circle is clicked. The problem is…
0
votes
3 answers

What is the proper way to use Listeners?

My boss says I write Listeners wrong, and can not bring any good arguments as the why. The way I usually do it is this: View.OnClickListener onClickListener = new View.OnClickListener() { @Override public void onClick(View view) { …
0
votes
1 answer

Handling key events not working in service

I am Facing a problem and problem is I started service in activity, I used the below method in service class but its not working. public boolean onKeyDown(int keyevent, keyEvent event) { if ((keyevent == KeyEvent.KEYCODE_VOLUME_DOWN)) { …
Ramakrishna
  • 68
  • 1
  • 1
  • 9
0
votes
3 answers

Trying to catch a click on android ListView item

I saw many variation of this question in SO but none of the answers fix my problem so I guess my implementation is a bit different than the rest. (I put all the recommendation like android:descendantFocusability="blocksDescendants" etc.) I am…
GyRo
  • 2,586
  • 5
  • 30
  • 38
0
votes
1 answer

onTouchListiner & OnLongClickListener on ImageView didn't work

i add those listeners to an imageView like this : view.setOnTouchListener(clickEvent); view.setLongClickable(true); view.setOnLongClickListener(longclickEvent); OnTouch event rises and OnlongClick did not. OnlongClick work only if i erase OnTouch…
habibhassani
  • 486
  • 1
  • 6
  • 15
0
votes
1 answer

Android: Web page not launching on tablet

For some reason, when I try and launch a web page from an onClick event in my login screen nothing happens. This only occurs on tablets, and works fine when testing on the phone. I get this error message on a Galaxy Tab when clicking the…
pech0rin
  • 4,588
  • 3
  • 18
  • 22
0
votes
1 answer

What motion event would I use for this situation?

I'm using an on touch listener to display and hide some volume controls, on ACTION_DOWN the controls are displayed and on ACTION_UP they are hidden. I want to be able to touch the controls without lifting my finger, I tried using the ACTION_MOVE…
jn025
  • 2,755
  • 6
  • 38
  • 73
0
votes
1 answer

Protect View from continuous touch events

I'm building a camera app like vine, where you record a video as long as you hold your finger on the screen. My problem: If someone taps quickly and continuously on the screen the camera logic receives too many events. It constantly tries to write…
j7nn7k
  • 17,995
  • 19
  • 78
  • 88
0
votes
3 answers

Detect ongoing touch event

I am currently trying to detect an ongoing touch event in my Android app. In detail I want to recognize within a fragment whether the user touches any part of the app's screen. Android's OnTouchListener works as expected except if the touch event…
Markus
  • 1,649
  • 1
  • 22
  • 41
0
votes
1 answer

Android pinch-zoom and long-click conflict between views

I have a GLTextureView inside a ZoomableViewGroup, essentially a canvas which can be scaled using pinch-zooming gestures and panned with two fingers—single-finger touches are used for fingerpainting on this canvas. On a layer above that, there are…
ike
  • 117
  • 1
  • 3
  • 11
0
votes
1 answer

how to add reminder to calender in android

i am new to android.I am trying to create a calender where I can set reminders for a particular date. for example ,If I set any reminder on 10Th Aug,I should get a notification for that The code is as follows CalendarView.java public class…
0
votes
2 answers

How to detect android calendar events are edited?

I already complete contacts synchronization. In contact synchronization I use VERSION flag for detecting existing contacts edited by user. But in calendar synchronization I cannot find VERSION flag. Then How I detect existing calendars are edited or…
stacktry
  • 324
  • 3
  • 24