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
1
vote
2 answers

AboutToQuit signal/event in Android

I'm new to Java and Android and I'm coming from a Qt/C++ background. In Qt there is this QCoreApplication object that represents the whole application and when this object is destroyed, the application dies. In Qt there is this signal on…
Jacob Krieg
  • 2,834
  • 15
  • 68
  • 140
1
vote
1 answer

Android show description of what a button does when user performs a long touch on it

In my Android app, I want users to be able to learn what a button does by performing a long touch on it, showing a description that looks like the "More options" description of an overflow menu button. Also, can I disable the vibration that is…
Haris Gušić
  • 197
  • 2
  • 12
1
vote
1 answer

Android ActoinBar homeAsUp only works once

I'm working on an app that only uses a single Activity and switches out fragments as they are needed with the navigation drawer. Now we want to navigate back from one of these fragments by using the homeAsUp button in the ActionBar. I have followed…
1
vote
1 answer

Capture Android power button event

My app has a long running background service. I registered my service with a broadcastreceiver which handles SCREEN_ON and SCREEN_OFF actions. However, the problem with using this approach is that while it does work, whenever the phone was woken up…
hal0360
  • 81
  • 1
  • 7
1
vote
1 answer

Hide the "Tap To Translate" Notification on Android

If a user has set the Tap To Translate icon to appear on copying text, is there any way to disable it from appearing when text is copied in my app only? The icons appears over the app as shown here:…
arcticfeather
  • 195
  • 1
  • 9
1
vote
0 answers

Android Development - How can GestureDetectorCompat class Object used for detecting gesture methods from GestureDetector class

I was going through some tutorials for detecting common gesture and saw the code given below. Here, GestureDetectorCompat Object is made to detect the gestures using the event handler SetOnDoubleTapListener. The main activity class implements two…
1
vote
0 answers

Get and listen for pre set alarms from android os

I wanna ask if I can get the list alarms set in Android OS and then listen for the event when any specific alarm is triggered.
Fawad Khalil
  • 357
  • 3
  • 20
1
vote
3 answers

android on touch human image detect the body part. What layout element should I use?

On the following image I would like to detect what part of the human body the on touch event happened. My idea was to have a GridView and determine the position of the human body where the touch event happened. A GridView seems an overkill though.…
1
vote
1 answer

onKeyPreIme does not call

I have a custom view that inherites LinearLayout and that view is in a ViewSwitcher. I want to return to previous view on Back pressed, So i overriden the onPreKeyIme in this view but when i press Back, it doesnt seem to enter the method, and the…
Ari M
  • 1,386
  • 3
  • 18
  • 33
1
vote
2 answers

Use “ENTER” key on softkeyboard to initiation an Event

I'm designing an android keyboard and am having difficulty with initiating an action command from the keyboard. When I am using the Internet on my device and press enter after typing in a website, rather than going to a new page, a space is shown…
1
vote
0 answers

Android - Getting values Dynamically in on tuch Listener in Multi Level Listview

I have a multi-level list-view like this- I want to add onclick listeners for each Level 3 element. What I have done is like this- void showAllDataInShrinkableList() //Show all data and set on click events { //Adds data into Level…
Abrar Jahin
  • 13,970
  • 24
  • 112
  • 161
1
vote
1 answer

Android - "Faking" a touch event not working

I want to fake a touch event and I have got the possible answer here. However When I attempted to make it work, it didn't work. Note that I am running the following code in the thread. private Handler handler = new…
Fish
  • 1,689
  • 1
  • 18
  • 28
1
vote
1 answer

Eventbus - how to unregister POJO?

How and where should I unregister the EventBus in POJO which is independent from the android lifecycle? (no onCreate-, no onDestroy-method) Thanks in advance
dowjones123
  • 3,695
  • 5
  • 40
  • 83
1
vote
1 answer

How to make maps marker title always visible

I want to make the markers title always visible When I use marker.showInfoWindow(); it only works on the fist opened map when user drag the map to another marker it will be without title. is there ant way I can make it visible all the time? If…
1
vote
0 answers

handle event when pushwoosh received message in the background

I've implemented pushwoosh in my android app and would like to perform some task when the pushwoosh is received while in the background. The way I see it - pushwoosh only lets me perform code once the user clicked the notification. How can I…
Bended
  • 494
  • 1
  • 7
  • 22