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

Android EditText - Consume event of a specific key press

I have a class MyEditText that extends EditText. When receiving a specific keycode from an InputMethodService, say 35 which is equivilant of '#', I want to perform an action on my EditText instead of appending it to the text. Solutions that did not…
tba
  • 333
  • 3
  • 15
2
votes
0 answers

Stop view pager swipe propagation

I've a view pager with 3 fragments. Inside one of these I've another view pager. When i swipe the nested one and arrive to "end", then its "parent container" starts swiping itself. I'd like to prevent child to parent event propagation. Any simple…
Jumpa
  • 4,319
  • 11
  • 52
  • 100
2
votes
1 answer

Delegate touch event to another view

I have list view with. User can open dialog on full screen Window.FEATURE_NO_TITLE) that overlay this list view. When user touches the background of this dialog it closes. I need to delegate this touch event to list view. I mean, after…
2
votes
0 answers

Checkable Checkbox inside layout that represent every item of List/Grid-view

I have the following layout for items that fill my GridView:
Zharro
  • 819
  • 1
  • 11
  • 23
2
votes
0 answers

onTouchEvent in AdapterView's item

I have overridden the onTouchEvent method in a custom view: @Override public boolean onTouchEvent(@NonNull final MotionEvent event) { Log.d("TouchEvent", String.valueOf(event.getActionMasked())); if (event.getActionMasked() ==…
Diolor
  • 13,181
  • 30
  • 111
  • 179
2
votes
1 answer

using Intent to delete events in calendar

I am trying to write a personal manager app which has events from all the calendars in the device. So when I add event I am using CalendarProvider and Intents and passing the control to native calendar so that user can add event details and save…
2
votes
1 answer

Android Application Startup Event

I am looking for a possibility to monitor if a application gets started, i.e. if the user starts any app on his phone, my app should register that. Is there an easy way to achieve this? Such as an broadcast event?I tried out to catch the…
DonMushroom
  • 442
  • 3
  • 19
2
votes
1 answer

Edittext focus is not changing in android

In my layout I am using two Spinner and Editext ,when I click outside the Edittext soft keypad is not hiding and also Edittext focus is not changing.. My layout file:
venu
  • 2,971
  • 6
  • 40
  • 59
2
votes
2 answers

onDragEvent() throwing nullpointer on Nexus

I am sorry if I have done any silly mistake, but I cant find the source of this: I am trying to implement a onDrag listener on my EditText "etItem" This is my code: etItem.setOnDragListener(new OnDragListener(){ @Override …
A Nice Guy
  • 2,676
  • 4
  • 30
  • 54
2
votes
2 answers

how to get Spinner List's selected items's text and fill EditText in android with that value

when I try to get the EditText object in the Itemselected function of selection listener the line throws NullPointerException Male
2
votes
2 answers

onShowPress and onSingleTapConfirmed

I want to implement the following behavior: When the user starts to single-tap my View, highlight the View. When the user finishes the single-tap (releases the touch),stop highlighting the View. Just like with simple Buttons. I tried to achive this…
WonderCsabo
  • 11,947
  • 13
  • 63
  • 105
2
votes
1 answer

Android : Set reminder functionality

I am developing an application with reminder functionality. The code i used is as follows to set the reminder and event: private void addReminder(int statrYear, int startMonth, int startDay, int startHour, int startMinut, String title){ //…
2
votes
1 answer

Native Android code send event to main Java code

in my Android app I have a native code that runs on separate thread, it use a while loop. The native code send data periodically to backend server using HTTP GET method. Now, I need the native code to also "send" data to my main Java UI thread. My…
bonchenko
  • 567
  • 1
  • 9
  • 21
2
votes
1 answer

How to get events from calendar for particular week in android?

I want to display the events for only one week in the listView,but I got all the events and it is displaying in the listview. I am using this code to get the events for particular date ,but is not getting any events from calendar.The event count is…
user2841300
  • 353
  • 1
  • 7
  • 23
2
votes
1 answer

PorterDuffXfermode drawing black line with CLEAR mode

I have an imageView with background and foreground image. When I try to erase by foreground using Path and Paint with Clear setting, instead of deleting the foreground path its drawing black lines. Can someone help me please? Here is my code…