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.

Filter by
Sorted by
Tagged with
0 votes
1 answer
39 views

How to Run Event before any task on Java Android?

I have code and worked for Exit Application with this code: class Example extends Dialog { @Override public void dismiss() { super.dismiss(); if (isForceExists != false) { ...
wiefunkdai's user avatar
0 votes
0 answers
50 views

How is "MotionEvent... recycled twice!" possible?

ScaleGestureDetector scaleGestureDetector = new ScaleGestureDetector(getActivity(), new ScaleListener()); relativeLayoutCell.setOnTouchListener((v, event) -> { scaleGestureDetector.onTouchEvent(...
Hong's user avatar
  • 17.9k
0 votes
0 answers
21 views

How to reconstruct the MotionEvent from raw event log

Is there any way to reconstruct the MotionEvent from the raw event log like this [ 75895.529710] EV_KEY BTN_TOUCH DOWN [ 75895.529710] EV_ABS ABS_MT_SLOT 00000000 [ ...
Carpemer's user avatar
  • 257
0 votes
1 answer
86 views

How can I detect the onFling event in Android?

Based on various examples I've found around the internet, I've got this as my code to pick up "swipes" (onFling AFAICT) However the only event handler that seems to be called is the ...
interstar's user avatar
  • 26.3k
0 votes
1 answer
58 views

Local alarm for a foreground service?

I have a foreground service and while it's active I want to run some events based on specific exact time that you a user previously set, it can be one time or it can repetitive every day for example. ...
user924's user avatar
  • 8,857
0 votes
1 answer
134 views

How to get view with x and y position on Android

I am trying to get view in dispatchTouchEvent(). However, this only passes MotionEvent. It has x and y position. But, it doesn't pass view itself. I can get view with currentFocus. However, this gets ...
c-an's user avatar
  • 3,623
1 vote
0 answers
42 views

Can an Android Service detect if an event was consumed by App or not?

I am running an Android application. An event happened (i.e. user double pressed the home key). There can be two possibilities, The application consumed the event and passed (or restrict passing) to ...
Sazzad Hissain Khan's user avatar
0 votes
0 answers
130 views

Android calendar add recurrence event but only effect for a short time

im testing android calendar recurrence event. Im have setted an event to android calendar and add a rrule, code like this: public static int addCalendarEvent(Context context, CalendarEvent ...
henry's user avatar
  • 25
0 votes
1 answer
113 views

How to drag a whole activity-layout and treat the drag as a back-button in Android?

I want to implement an Android-Application like gallery or photos. I have several small photos. When I click on a photo, I open another activity which displays the foto over the whole screen. I want ...
user650708's user avatar
2 votes
1 answer
779 views

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 ...
portsample's user avatar
  • 1,986
0 votes
1 answer
164 views

How to get id of the item clicked from layout action in android?

I am validating the EditText value by clicking anywhere inside the window. But for some buttons, I want to do something different from the validation functionality. How can I get the id of the item ...
Malhotra's user avatar
  • 241
4 votes
0 answers
586 views

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 ...
Rahul Kahale's user avatar
1 vote
2 answers
586 views

How to properly support click on selectable textview in Android

I have a LinearLayout with a selectable text view <LinearLayout android:id="@+id/linear_layout" android:layout_width="match_parent" android:layout_height="...
Tushar Kathuria's user avatar
2 votes
1 answer
217 views

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 ...
David Bichara's user avatar
0 votes
2 answers
721 views

How to disable Settings button of input fields in KIOSK mode

I want to how is possible to disable Settings button of input fields in KIOSK mode ? I have read the KNOX and KIOS official doc and searched on Stackoverflow, but was not able to find a working ...
Salut Amigo's user avatar
2 votes
0 answers
1k views

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 ...
Joseph's user avatar
  • 1,070
2 votes
0 answers
206 views

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 ...
pazz98's user avatar
  • 73
0 votes
0 answers
40 views

there is no default constructor available in Conferenceable [duplicate]

I'm a beginner for android. I want to develop an app for the detection of conference call. so in this line, I faced there is no default constructor available android.telecom.Conferenceable. import ...
user avatar
-1 votes
2 answers
58 views

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. ...
seungyong's user avatar
-1 votes
1 answer
347 views

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 ...
Maxime Godinas's user avatar
0 votes
1 answer
331 views

Event Bus Subscrided event not calling

I used the following code to communicate between the fragments of Tablayout. Produces the following error. No subscribers registered for event class MessageEvent D/EventBus: No subscribers registered ...
Swamy's user avatar
  • 65
1 vote
0 answers
59 views

How to show Alert Dialog when the activities are in transition phase from one activity to another?

I have an activity called LoginActivity, where in user explicitly logs into the app using username and password. When he logs in I want to register him for push notifications by sending his device ...
Shiva's user avatar
  • 543
3 votes
1 answer
194 views

Android Architecture Components

I am using MVVM android architecture for my application. I want to implement click event, so, do we need to use data binding architecture components or we can just use activity for handling the click ...
Harsh Shah's user avatar
  • 2,202
0 votes
0 answers
308 views

Class name doesn't reside within package name (from AccessibilityEvent)

I am working on an android service that tracks window state changes on a device. Each event is logged, including the reported package name and class name that triggered the event. I noticed that some ...
Matthew Steinhardt's user avatar
1 vote
0 answers
97 views

How do I trigger an onClick event when a finger goes outside the button in the screen during long click

public boolean onLongClick(View arg0) { Toast.makeText(getContext(), "long click", Toast.LENGTH_SHORT).show(); return false; } public void onClick(View ...
Shree's user avatar
  • 43
-1 votes
1 answer
43 views

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 ...
Shiva's user avatar
  • 543
0 votes
0 answers
34 views

Refactoring Suggestion for PagerAdapter implements View.OnClickListener

I have the following code but I'd like to consolidate the View.OnClickListener objects into one function by implementing View.OnClickListener. But When the position of the page keeps changing when the ...
g_studio's user avatar
1 vote
2 answers
72 views

How to Stop Event's While Animation is in process?

I am working on Animating my view where i animate the translation and scaling of View. Problem: If my animation duration is for 2000 ms (2 Sec) i don't want any user event's to interfere in between ...
Anmol's user avatar
  • 8,260
0 votes
1 answer
345 views

Right and Left click on ViewPager

How do i detect if i have clicked or press at right side of viewPager or at left side of viewPager. I have tried with GestureDetector but couldn't make it out. Help me
Jignesh Siddhpura's user avatar
0 votes
1 answer
54 views

Make ImageView appear when RecyclerView is longpressed and disappear when released?

I would like to create a RecyclerView in which a user can long click an image and preview the full sized image until they release the long click. I have it mostly working but the issue I am having ...
Isaac Perez's user avatar
0 votes
1 answer
1k views

How to use EventBus in two Activity on Android

In my application i want use EventBus for manage events. In my app i open activity B on the Activity A ! and i want when activity B finished, call one event in Activity A. I write below codes ...
Jungle's user avatar
  • 247
3 votes
3 answers
890 views

Continue onScroll event after onLongPress

Does anyone know how to combine onLongPress(MotionEvent e) and onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY)? Idea is to start with onLongPress but continue with sliding ...
RadoVidjen's user avatar
3 votes
1 answer
875 views

Handling TouchEvents on RecyclerView

I have this code which implements a RecyclerView and I want to add to it some gestures. I want 2 things to do and I don't know because I'm new to this. When someone clicks on RecyclerView I want to ...
Nick's user avatar
  • 2,868
0 votes
1 answer
203 views

multiple fragments and activity all responding to button click in activity

I have a multi-fragment form dividing sections of a form. When the user is finished they hit the submit button at the bottom of the screen which is owned by the hosting activity. When the user clicks ...
user avatar
1 vote
1 answer
1k views

why can use getParent ().RequestDisallowInterceptTouchEvent (true) disallow Intercepted

@Override public boolean dispatchTouchEvent(MotionEvent ev) { // why this code can be executed. getParent().requestDisallowInterceptTouchEvent(true); return super.dispatchTouchEvent(...
Guo's user avatar
  • 1,761
2 votes
4 answers
1k views

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 ...
Vibhor Gupta's user avatar
0 votes
1 answer
278 views

ACTION_UP does not recognize after Action_DOWN

In my project i need to use the onTouchListener in order for me to know when the user touch\don't touch specific buttons and send data to my server in both cases. the code: private View....
Ido's user avatar
  • 55
0 votes
0 answers
36 views

Not receiving data sent to the server after ACTION_DOWN event

the problem is that i only recieve the data that sent from the client to the server after hitting the imagebutton and the event was action down. i found out that the checking on event_up never send ...
Ido's user avatar
  • 55
1 vote
0 answers
94 views

How can I capture SCREEN_OFF/ON event when the app is idle?

For a proof of concept, I need to be able to capture whether the phone gets interactive, and the other way around. So far, I tried following methods: with BroadcastReceivers capturing SCREEN_OFF and ...
danimart's user avatar
0 votes
1 answer
49 views

How to translate event driven code?

I'm mostly C# developer and I'm recently working on some Android project. I have to implement some custom written events in Android, but I'm not sure how to do that. I wrote a C# code for what I want ...
delux's user avatar
  • 1,744
0 votes
1 answer
88 views

NumberPicker, OnValueChangedListener, distinguish change from user and from programmatic change?

It seems that OnValueChangedListener is called when the value is changed programmatically by the app itself. Can I make it raised only when the user rotates the dial or know whether the event is from ...
Damn Vegetables's user avatar
0 votes
0 answers
579 views

How to decrease sensitivity of onTouch?

How to decrease sensitivity of onTouch ? I have a custom remote with a virtual touch pad on it. The problem is that when I move finger over the touch pad the mouse cursor moves very fast. So is there ...
abrutsze's user avatar
  • 496
6 votes
5 answers
10k views

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 ...
Joonsung Kim's user avatar
1 vote
1 answer
2k views

Android Remove Background property in Image view

I am added a background image highlight in RecyclerView Image: but when i click the image previous selected image highlight is also shown. how to fix this. my code is holder.colorImage....
Dhinakaran's user avatar
1 vote
1 answer
527 views

Android calendar deletes calendar and events after 10 minutes

I've been working on an app that involves making events. I've successfully created a calendar on the default calendar on Android, and I've been able to add, delete, or update events on this calendar. ...
dk31's user avatar
  • 23
1 vote
2 answers
153 views

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 ...
Jacob Krieg's user avatar
  • 2,894
3 votes
1 answer
598 views

How to compare MotionEvent downtime to a clock, what is its time basis?

I am trying to determine the chronological ordering of a MotionEvent vs something that happens periodically in my UI object. private var rotateFinishTime: Long = -1 .... fun ...
androidguy's user avatar
  • 3,055
0 votes
0 answers
270 views

Android: how to do background clickable effect by programmatically?

I have a background for button. <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_focused="true" android:state_pressed="false" android:drawable=...
Greed Ruler's user avatar
0 votes
1 answer
3k views

Intercept click/touch event without overriding ViewGroup or View methods

Is there any way how can I intercept/decorate view's touch event without extending View or wrapping in some ViewGroup (which can intercept child events)? Suppose I have ExpandableListView which ...
matoni's user avatar
  • 2,509
0 votes
1 answer
455 views

How to get row selection event and item click event in custom adapter listview all together in Android

I have custom list of two text views having different text string. These are items in the list. In current scenerio I can only register the setOnItemClickListener for the list. This is triggered when ...
Adnan Karbelkar's user avatar

1
2 3 4 5
7