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

registerOnSharedPreferenceChangeListener Stops getting called after some time

I have a sharedPreference that that gets updated continuously (around every second)from a Class which extends BroadcastReceiver. The first few times, the registerOnSharedPreferenceChangeListener gets called, but after a while, it stops getting…
0
votes
1 answer

osm store drawn path in database

Scenario:Using OSM in android ,user draws the path manually on map and clicks on save button, to save in database as a string. Polyline myPolyline; /* updating myPolyline here */ …
0
votes
1 answer

Android Event Handling

I have image for adding 1 to some edittext, and I have written code to handle onclick event of that image and its running fine. But I have to implement that if the user presses the image it should increment the edittext and if he keeps the image in…
user3726986
0
votes
2 answers

Best way to handle multiple event listeners

Let's say I have a spinner(with 2 items) and a radiogroup (with 2 radiobuttons). I want to show for example a TextView in my layout which will be with different values for every choice: For example we have: Spinner Male Female RadioGroup True…
ElaGorilaki
  • 227
  • 6
  • 20
0
votes
1 answer

Update text watcher based on other events

In one of my screen i am using text watcher to check value against a range and for invalid range color of text is being changed. Now there is one more requirement. Along with EditText i need to use CheckBox to set completely different range. The…
0
votes
1 answer

Responding to user events in different Activities

What's the best way for an Activity to respond to events from another Activity? For example, suppose I get to Activity B from Activity A. B has a button that does something (specifically, send some info via http request). Now when I go back to…
ono
  • 2,984
  • 9
  • 43
  • 85
0
votes
1 answer

Consolidating responses from N async service calls into 1 response for your client

I'm currently doing some Android app development. I'm new to event driven programming. So this is probably a newbie question. Imagine the following logic: class A { function1() { call function2(new Callback()) } class…
Fayez
  • 17
  • 7
0
votes
2 answers

Android Event Listener's initialize crashes app

I am using the AVD Emulator to run apk. I have created a simple activity, which has two buttons, however whenever I write code for any of them, the app won't start, excluding to initialize them. If I declare the actionlistener like below (code…
eitharus
  • 15
  • 7
0
votes
1 answer

ViewGroup in event listener

I am trying to include a new layout on an event. For that I am using LayoutInflater in That event listener. But the problem is, LayoutInflater.inflate() function expect its parameters to be (Int) ResourceId, ViewGroup. I am unable to figure out what…
Sourabh
  • 1,757
  • 6
  • 21
  • 43
0
votes
2 answers

Schedule TextView update

In my application in every activity at the top I have a fragment with TextView showing the current event that is taking place. It looks something like this: -------------------- | Event name | |------------------| | | | …
nikmin
  • 1,803
  • 3
  • 28
  • 46
0
votes
3 answers

How to prevent onTouch for parent Linear Layout from executing multiple times child?

On touch event for a lienar layout multiple screens pops up. It seems that the ontouch event gets fired twice for each child element of the linear layout. How can I prevent this from firing twice. On click event for the same linear layout causes,…
user2703132
  • 113
  • 1
  • 4
0
votes
0 answers

Android ~ detection any other application/service

I know there are methods to find the running applications, services.. in Android. But is there any event to detect if any other application/service installed or unistalled?
aysbtl_
  • 339
  • 1
  • 3
  • 18
0
votes
1 answer

Android Root Accessibility Event Listener

I need an event to watch if the root accessibility is taken or not on android device. I did without using eventlistener. This program stores the root access information on SQLite database. In some period, it checks the current root access info and…
aysbtl_
  • 339
  • 1
  • 3
  • 18
0
votes
1 answer

Android: Not All Instances of Recurring Event Saved

I am currently working on creating a custom calendar application and have been struggling with saving a recurring event. If for example I set the event to occur daily for 100 days I am only seeing about 38 instances saved to the instances database.…
0
votes
3 answers

Changing the content of layout such as text and images before starting the Intent

I have 2 views, MainActivity and UnitActivity. In main activity there are some buttons and when user clicks on them I want to bring uo UnitActivity. In UnitActivity layout file there are some views like TextView. For example, if the user clicks on a…
Dumbo
  • 13,555
  • 54
  • 184
  • 288