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
0
votes
1 answer

How set an OnClickListener by not extending ListActivity

How am I to set an OnItemClickListener event for a Listview if I'm not extending ListActivity class? Can someone provide me with an example please?
rosesr
  • 749
  • 1
  • 7
  • 10
0
votes
1 answer

List Item is not clickable in Android

I have a Custom ListView, in the List there is 3 ImageView and 4 Textview . I can not tap on the List Items and I am able to tap on the blank spcae. So what to do to tap on the List item and the onClick Listener should work ?
Subrat
  • 3,928
  • 6
  • 39
  • 48
-1
votes
2 answers

Why doesn't "setOnClickListener (this)" work in "for in"?

I want to register an event via "for in" by putting TextView in MutableMap. But it says that "item" is not "textview". What is the reason? menus ['appetizers']. setOnClickListener (this) works. class MainActivity : AppCompatActivity(),…
seungyong
  • 11
  • 4
-1
votes
1 answer

Event triggered when shutdown an android app

When I shut down my android app, I would like to stop an another app. To realize this behavior, I thought to catch an event (e.g. onDestroy on my activity or my background service) and to send a message to my oher app that signal it to stop. My…
-1
votes
1 answer

Defining onlick for listview: Onclick at listView level vs Onclick inside custom view adapter

In custom adapters click event handling, which is better (considering performance and memory) , 1)Defining click handler at ListView level. 2) Defining a click handler inside custom adapter. Will defining click handler at Custom Adapter level…
Shiva
  • 543
  • 1
  • 6
  • 20
-1
votes
1 answer

How to Fill Email app with data populated from a fragment that uses data from a pure java class?

I have just started learning fragments in Android.I am now able to display data in fragments using ListFragment and ArrayAdapter. Now, I am trying to use onclickListener and intents on fragments like the way we do with activities and buttons. I am…
-1
votes
1 answer

how to get duration of pressed button before release it?

I want to calculate duration of when Action_Down button before Action_Up in onTouchListener Can I get how long my button was pressed? And doing something when timeout reaches to my desire value? For example, i want to make a customize…
user5431746
-1
votes
1 answer

Click event does not fire in Android Fragment

I have read several SO posts that has the same questions as I do: When I add a OnClickListener for a View (in this case an EditText) inside the Fragment class, the click event is never fired. If I move the code away from the Fragment class and move…
Ted
  • 19,727
  • 35
  • 96
  • 154
-1
votes
1 answer

Android app do something on close service/app

I have an app which has a queue in the background to do something. I also have a service which shows and updates a notification in the notification-center about the progress of the queue (because it is not depending on a certain…
Joehl
  • 3,671
  • 3
  • 25
  • 53
-1
votes
1 answer

How to track how long an item in Android listview stays on screen

Is there a way to detect the entry and exit of a particular item in the list and find the time difference between two events?
dowjones123
  • 3,695
  • 5
  • 40
  • 83
-1
votes
2 answers

Android:OnClick Event not functioning

I have imageView for play and stop and I have tried to implement OnClickListener. But the click event is not handled. Even if I try to start the application in debug mode then also I am not able to detect click event. What could be the error in…
LearningBasics
  • 660
  • 1
  • 7
  • 24
-1
votes
1 answer

What method is called when i change activities?

I have a MediaPlayer that keeps playing when I change activities and when I even click the physical Home button on my phone. How can I make it so that the MediaPlayer keeps playing when I change activities yet stops playing when I click the Home…
Bob Smith
  • 505
  • 3
  • 10
  • 27
-2
votes
1 answer

Android: Detect OnClick, and whether another element is on top

Strange one, but I want to do the following: Have a round element about the size of a finger tip in the bottom right of the screen. Have some images come in from the left of the screen, at the same Y position, which move from left to right and…
Lee Valentine
  • 95
  • 1
  • 2
  • 8
-2
votes
1 answer

Send android event from php

I'm trying to create intranet PHP application that communicates with android phones. So I was wondering is it possible to trigger android event from PHP and I don't need push messages. Thanks.
-2
votes
1 answer

Event "Sliding" in android

I want set event when user touch and sliding right -> left: -> " I want set 'Next' event", and sliding left -> right: -> "I want set 'Previous' event". .. in Linerlayout Can you helps me! Thanks so much
1 2 3
21
22