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
6
votes
5 answers

How to disable "air command" on Android devices?

Hi, I've developed an application using a stylus (e.g., Samsung pen). As you know, when we click a button on the stylus, "Air command" (pop-up window) appears. My goal is "Overriding the air command into my custom functions" First, I started with…
Joonsung Kim
  • 246
  • 1
  • 3
  • 15
6
votes
3 answers

Android EditText onClick Listener defined in Layout fails with obscure Exception

I want to define an onClick Listener for an EditText in the Layout-XML of may activity, but it always fails with an obscure Exception. The Layout is injected with setContentView()in the onCreate-Method of my activity. I am not using a Fragment here…
Wildsau
  • 405
  • 5
  • 9
6
votes
1 answer

getDownTime() and getEventTime()

What is difference between:getEventTime() and getDownTime()? In documentation http://developer.android.com/reference/android/view/MotionEvent.html Both seems to do the same thing but they output different values.
Michał Tajchert
  • 10,333
  • 4
  • 30
  • 47
6
votes
3 answers

android: EXDATE format when adding a calendar event

Can someone explain how to use EXDATE when adding event to android calendar? The documentation is pretty unclear about the format in which the EXDATE should be put. I tried many formats, these are some of them: values.put(Events.EXDATE,…
nikmin
  • 1,803
  • 3
  • 28
  • 46
5
votes
3 answers

Listening WIFI state

I want to set listener to listen on wireless state,can anyone help me with my code import android.telephony.PhoneStateListener; import android.telephony.TelephonyManager; ... TelephonyManager wTelephonyManager; ... …
Tony
  • 1,175
  • 4
  • 14
  • 22
5
votes
1 answer

How to enable Drag a Marker (Android Map Api v2) after a single Touch?

I have a map with some markers. I set the listener for drag: map.setOnMarkerDragListener(this); But the drag is enable only after the user long press the marker. I want to enable drag immediately. Is there a way to do this with Android Maps (v2)?
alexpfx
  • 6,412
  • 12
  • 52
  • 88
5
votes
1 answer

Take photo with button simulate programmatically like the selfie stick via bluetooth

So i have a bluetooth device, i listen to button press on the device and i try to take a photo when the button is pressed. The issue is i didn't find any solution to do this. } else if (destination.equals(APPLICATION_ACTION_DESTINATION_OPEN_CAMERA))…
5
votes
7 answers

How is it possible to know which View is clicked in a layout OnClickListener?

I have a layout which contains some views. I want to set some actions when a user clicks anywhere on the layout, so I have set an OnClickListener for the layout which works as it should. But how can I know which view was clicked? I want to assign…
Babak-Na
  • 104
  • 1
  • 1
  • 8
5
votes
7 answers

SlidingUpPanelLayout and ScrollView

I have a SlidingUpPanelLayout that holds a image as a top view, and a view pager that needs to slide. The viewpager has 3 fragments and two of them are list views. So I want to be able to expand the view pager on pulling up, and once the view pager…
5
votes
2 answers

How to Customize the Share Intent Onclick Event in Android

How to customize the Android Share Intent for Facebook App. When I am using the share Intent, I am getting the following dialog. But I am using Facebook sdk for post the image and text. And how to customize, when we click on Facebook icon in the…
Mr. N.V.Rao
  • 1,082
  • 13
  • 27
5
votes
1 answer

Obtain view that is touched with GestureDetector

I have implemented GestureDetector in my Activity. Right now I can grab all events from whole screen like onSingleTapConfirmed, onDoubleTap, onLongPress... Is it possible to detect, which View from my custom layout was pressed ?
hsz
  • 148,279
  • 62
  • 259
  • 315
5
votes
2 answers

Fire event on AsyncTask finished

My app has a login activity and it checks the credentials via an internet website. To do so, I (have to) use an AsyncTask class. When login is successful, a global variable is set to true. Because this is asynchronous, the activity won't wait for…
Eric
  • 695
  • 9
  • 25
4
votes
3 answers

How to notify from B activity to A that list data has been changed?

I have a Activity ItemList.java. When user click on item, it starts new activity, let's say ItemDetailActivity.java. What I want to do is, when the user presses a button on ItemDetailActivity.java, it should tell ItemList.java to refresh list item.…
Arslan Anwar
  • 18,746
  • 19
  • 76
  • 105
4
votes
0 answers

app_remove firebase event count for Android app

Need help understanding the app_remove event from the firebase analytics report for my Android app. It shows total 9 users 3 app_remove events 3 users for whom the app_remove event occured And the event count per user is mentioned as 3 If we…
4
votes
3 answers

What hovering means on button in Android?

I know that we can catch Hovering event in Android. So, I added a Button in my layout files. What does Hovering mean in Android ? Press button and lifting finder from it? Put your finger on button (Impossible in Android). We can do it by…
user5063816
1
2
3
21 22