Intercepting clicks from subview in Android
My application has a custom view which contains other custom views of a different type. The subviews have their own click listeners (which I can't change, as these are in 3rd party libraries). How can I intercept a user's click at the level of my view to do some processing, and then pass the click on to the proper subview?
Asked by: Oliver331 | Posted: 20-01-2022
Answer 1
Justin, you can play with dispatchTouchEvent() or onInterceptTouchEvent().
Answered by: Kelsey702 | Posted: 21-02-2022Answer 2
I'm not entirely sure about this, but in Java what I would do is define various subview objects in my main view and simply send those to the draw/paint function. That way I'd only have ONE click listener which would be in the view anyways.
Can you do something like that in Android?
Answered by: Emma327 | Posted: 21-02-2022Similar questions
Intercepting touch events on activity and button on Android
I have an Android activity with an ImageButton. I would like to execute some logic when the button is clicked and show a different image for the pressed state, but also receive the touch event on the activity.
By default only the button receives the touch event. If I set the clickable attribute of the button to false then only the activity receives the touch event.
What's the best way to implement the touch...
android - Intercepting download in webview and downloading using HttpClient
I have created a WebView instead of directly linking to a link because the website has complicated redirect checks that prevent me from directly linking. However, in order for the download to complete, users have to long click on the link and save it. Users are confused. They think its broken.
I was wondering if it would be possible to somehow comprehensively obtain all the information that the WebView has pertaini...
intercept - Android Intercepting Events From Other Apps
Does anyone knows how to intercept events from other 3rd party Apps, say, games, Maps, etc.
This includes events like motionevents, screen prompts, etc.
We have limited success with capturing touch events via the AccessibilityService, click, longclick, etc. But hitting a blank dealing with motionevents such as gestures or how the users are interacting with the screen.
(we have approval from users to capture...
java - Intercepting WebView
Let if web page is bound to WebView, then is it possible to capture
the data that user is entering in the data fields of the web page?
In other words my activity need to intercept and interpret what is happening in
webview.... Is it possible?
android - Intercepting voice recognition
In my application I have a "search" screen where the user types into an EditText and then clicks a button to do a search.
I'd like the screen to automatically trigger the search after the user has used the voice recognition utility to populate the EditText with text. Is there a handler I can listen for to do this? I'm looking for a handler or message specifically for a voice recognition return.
Intercepting data from a longClick event in Android SDK
I want to get the details repeatably as long as the touchscreen is touched.
I used onLongClick but it gets only a View without the event and it only occurs once.
Please help me to get these details.
java - Intercepting method calls to the Reference monitor?
In Android, my understanding is that an application declares a list of permissions that it needs in the manifest file and during runtime, it makes a request to perhaps the Reference monitor which then decides whether this application has that permission.
Is it possible (without having root or having to modify Android's source code) to write a third-party application that can just intercept these requests (the requ...
android - Intercepting outgoing call - what am I missing?
I'm trying to write a simple app to capture the ACTION_NEW_OUTGOING_CALL intent and write some debugging information.
Here is my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.apis"
android:versionCode="1"
android:versionName="1.0">
<application androi...
Android: intercepting back key
since the back key destroys my application and all data will be lost I need to intercept it to ask the user if that is really what he wants.
I thought of the following structure:
@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0)
{
// ask user if he really wants to ex...
android - Intercepting the ACTION_CALL intent on HTC sense
I have an Activity to catch ACTION_CALL intent via intent-filter and route via my app which works fine on Nexus one, Moto Blur, and Samsung devices. But not on HTC sense. :(
The Intent.ACTION_CALL_BUTTON is called when the HTC sense button is pressed but when you dialed ACTION_CALL isn't received the log output s...
Still can't find your answer? Check out these communities...
Android Google Support | Android Community | Android Community (Facebook) | Dev.io Android