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 Touch UP not working

im kinda stuck with this project in android im trying to figure out why this is not working but i have no idea.This is By the way a custom view just in case. The problem is this the event ACTION_DOWN is working perfectly im getting the console debug…
Makenshi
  • 993
  • 3
  • 15
  • 28
3
votes
1 answer

thread.stop() exception

i want when the user open the application to play a song and when the song is finish a new activity will be fired, i put a skip button to allow the user to stop the song and go to the next activity, this is the code timer = new Thread() { …
William Kinaan
  • 28,059
  • 20
  • 85
  • 118
3
votes
2 answers

RadioGroup doesn't work properly

I want to give the user four choices, the first and second choices on a row and the third and fourth choices on another row. My problem is when the application starts I can select more than one choice, but I don't want that. This is my xml…
Totti
  • 665
  • 5
  • 12
  • 26
3
votes
1 answer

Mono for Android OnPause event not triggering on Galaxy Nexus

I put together my first Mono for Android project (targeting API level 8, minimum Android 2.2) and deployed it to an HTC Incredible [1] running 2.3.4. Everything worked great and breakpoints in my main activities OnCreate, OnStart, OnResume, OnPause,…
3
votes
1 answer

Android custom Event to Javascript EventListener

Is it possible to create in Android event, which sends data to Havascript EventListener in WebView? For example: In background, I start thread what search updates on server. When updates was found I send event to update data on user page. And I…
smie
  • 592
  • 1
  • 9
  • 25
2
votes
2 answers

OnKey event dispatched twice when I type some text into a textbox. How to prevent?

during my debug sessions I found a strange thing occurring. I have an EditText control for which I defined the current activity as OnKeyListener to perform validation while user…
usr-local-ΕΨΗΕΛΩΝ
  • 26,101
  • 30
  • 154
  • 305
2
votes
2 answers

A method for waiting for sensor data

I have a class which initiates a sensor listener when it is started. This listener writes the latest sensor value to a variable when an event is triggered. The class goes on to do some logic, and at some point, will check this variable and proceed…
Glitch
  • 2,785
  • 1
  • 27
  • 50
2
votes
1 answer

Disable Android checkbox listener

I am working on a data collection application that while in an active state locks the screen to prevent errant user interaction. I would like to "lock" the checkbox while in this state to prevent the user from checking or unchecking the box. While…
portsample
  • 1,986
  • 4
  • 19
  • 35
2
votes
1 answer

Android Studio - How to use implement swipe gesture in android game

I was working on a game on Android studio where user touch drives tiles to combine. To do this, I have used a GridLayout separated into rows and columns. The value is displayed with imageview and all gridlayout cells are linked to a separate cell…
2
votes
0 answers

BottomSheetDialogFragment- Close only on full swipe Kotlin Android

I have a BottomSheetDialogFragment to show list of items inside a fragment. Each list item got a click event mapped. The problem here is, most of the times click action turns into swipe down action and BottomSheetDialogFragment is getting closed. I…
2
votes
0 answers

How can I add events on my calendar view in Android app?

I have an app that has a CalendarView like this in the photo: And I want that it could take "events" with date and description from a list of events and put a little point (or something like that) in the calendar corrisponding of the date; For…
pazz98
  • 73
  • 1
  • 9
2
votes
4 answers

How to exit the android application on backpress?

The situation could be like say, I've 5 activities. Say Main activity, Activity 1, Activity 2, Activity 3 and Activity 4. One can use the Activity 1,2,3 & 4 directly with the help of buttons so inserted on Main Activity layout. Situation: User…
2
votes
0 answers

how to detect power button click 3 times in android in background in service?

I want to detect power button click event in application which has service running in background. However i am able to detect long click of power button in service. now i want to detect that power button click three times in background. (Using draw…
2
votes
3 answers

OnClickListener and OnTouchListener collision issues

Currently working on an app in which I implement a chat head to make a view on top. I use an image for floating icon for chat heads, it working fine. what problem I face is that, both onClick and onTouch event not working properly either one of them…
baldraider
  • 1,049
  • 2
  • 18
  • 48
2
votes
1 answer

How to get a spinner to display textview

I am trying to make a spinner that will display a different text view each time an item from the list has been selected. When I run my code, I am able to switch between the different items, but the text is not updating based on the selection. I have…
Sydney Gorman
  • 23
  • 1
  • 3