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
3
votes
2 answers

Android Development - GestureDetector.OnGestureListener or GestureDetector.SimpleOnGestureListener

I'm working on simple code to detect all the gesture like fling, scroll, etc and was going to implement the interface GestureDetector.OnGestureListener for overriding its methods but I got to know that same could be done with…
Eddy
  • 344
  • 5
  • 16
3
votes
0 answers

How to simulate the Facebook Swipe to dismiss effect in images with Android?

I'm using the Fresco library, com.facebook.fresco:fresco:0.10.0. I'm trying to combine two effects that use the Facebook Application. Zoom To Point Swipe To Close I created DoubleTapZoomableController class which extends of…
Johanna A.
  • 63
  • 7
3
votes
0 answers

Android Studio wont insert calendar event

I am writing a event searching. We added some webservices now the events wont push automatically to the calendar. The auto-add feature does not work anymore heres the code please ask as many questions as possible i do have the permissions in the…
3
votes
1 answer

Could not dispatch Event error

I am new in android and working on app.help me in this.My Log is here Could not dispatch event: class com.shalom.shalombase.event.RequestPurchaseEvent to handler [EventHandler public void…
Nadeem Yousaf
  • 563
  • 10
  • 31
3
votes
2 answers

Touching a view that's always on screen

I have a view that's always on the screen (over other apps), I wan't to receive touch events and than to pass them farther. The code from the running Service : WindowManager.LayoutParams localLayoutParams = new…
RCB
  • 2,253
  • 2
  • 25
  • 49
3
votes
1 answer

How to create events for custom control

I have created a library project for creating a pass code Layout. I have created four text boxes for entering pass code, each text box can contain only one character. But I am unable to create an event for returning the pass code. I want to fire an…
3
votes
1 answer

Android: Use onTouch and onLongClick together

So I have an EditText view, what I want to do is execute some code if the user touches the EditText view but execute another code if the user does a long touch/click, the problem I'm facing is that onTouch is always executed first before…
3
votes
1 answer

How to avoid Android button dragging out side the screen

i have implemented button drag in my application , but it working the problem is why am dragging button is going out side of side am not able see the button. but fix it. i need to drag side the the screen. i have tried below code if any wrong…
venu
  • 2,971
  • 6
  • 40
  • 59
3
votes
1 answer

Dispatch event from Scrollview to underlaying Viewpager

In my Android-App I've the following layout:
JimVanB
  • 1,215
  • 1
  • 13
  • 29
3
votes
4 answers

How to handle ListView Item LongPress gesture

i have small issues in event handling , i have List view custom adapter data , each row having date , title , price . when i click on row i need to display details page but when i long press on price , date or title i need to sort the list view. i…
user2251658
3
votes
2 answers

Can we detect if android app is updated from google play on introduction of a new version?

I have a app on play store and i want to provide app update through the play store. Also, on updation of the app i want to perform some task. So, how can i perform a task on updation of my app from the play store. I thought of maintaining current…
Neji
  • 6,591
  • 5
  • 43
  • 66
3
votes
1 answer

Get MotionEvent on keyboard

I'm looking is it possible to capture MotionEven data (pressure) on keyboard (in my app)? Or is there way to intercept all touches on screen in my app (something like full screen mode).
Michał Tajchert
  • 10,333
  • 4
  • 30
  • 47
3
votes
2 answers

ActionBar — shared button between activities

I have a button placed in an ActionBar. How can I make a button listener which is shared between different layouts that includes the ActionBar?
3
votes
4 answers

How to allow several listeners to handle the same OnTouch events in Android?

I have two different objects that implement OnTouchListener. One of them, uses the event data to modify some internal data, and the other one Updates the UI. The problem is that if I set them both to listen to the same View, only one of them handles…
Alex
  • 1,449
  • 4
  • 18
  • 28
3
votes
1 answer

Registering for an activity's events

Is there a way to register for an activity's events? I'm specifically interested in the onStart / onStop events, and I don't want to add special operations in the activity for that.
user940016
  • 2,878
  • 7
  • 35
  • 56