In the Observer pattern, an event handler is the function or method called on an observer listening for an event dispatched by the subject. Also known as an event listener.
Questions tagged [handler]
3718 questions
49
votes
3 answers
ASP.NET: How to access Session from handler?
i'm trying to store some values in the Session from a Handler page, before i do a redirect to a WebForms page, that will pick up the Session values and pre-fill the WebForm:
public class Handler : IHttpHandler
{
public void…

Ian Boyd
- 246,734
- 253
- 869
- 1,219
48
votes
6 answers
Handlers and memory leaks in Android
Please have a look at the code below:
public class MyGridFragment extends Fragment{
Handler myhandler = new Handler() {
@Override
public void handleMessage(Message message) {
switch (message.what) {
…

Rasmus
- 8,248
- 12
- 48
- 72
43
votes
5 answers
Run Handler messages in a background thread
I want to run some Runnable in a background thread. I want to use Handler because it's convenient for delays.
What I mean is
handler.post(runnable, delay);
Where runnable should be run in background Thread.
Is it possible to create such Handler?
Is…

Yaroslav Mytkalyk
- 16,950
- 10
- 72
- 99
38
votes
5 answers
Does jQuery have a handleout for .delegate('hover')?
I am trying to use:
$('mydiv').delegate('hover', function() {
$('seconddiv').show();
}, function() {
//For some reason jQuery won't run this line of code
$('seconddiv').hide();
});

Chris Abrams
- 39,732
- 19
- 51
- 57
35
votes
3 answers
Difference between Handler.post(Runnable r) and Activity.runOnUiThread(Runnable r)
Is there a difference between
new Handler.post(Runnable r);
and
activity.runOnUiThread(Runnable r)

VinceFR
- 2,551
- 1
- 21
- 27
35
votes
2 answers
What's the postDelayed() uses in kotlin
As I know postDelayed() have two argument runnable and duration delay.
What actually does below code in kotlin:
Handler().postDelayed({
sendMessage(MSG, params.id)
taskFinished(params, false)
}, duration)
Here 1st is…

0xAliHn
- 18,390
- 23
- 91
- 111
35
votes
3 answers
How to open mailto links in new tab for users that have gmail as the default mail handler?
On a web page mailto links open the default e-mail client. Now that Chrome offers the ability to set Gmail as the default e-mail client, some users have the links open in the same window thus taking them away from the page they clicked the link…

Martin Henk
- 351
- 1
- 3
- 3
34
votes
5 answers
difference between Thread and Handler
Can somebody tell me the deference between Thread and Handler? When we use Thread and when we use Handler?
I have two code in my project , But I can't understand them.
final Handler handler = new Handler()
{
@Override
public void…

Khodayar
- 391
- 1
- 4
- 13
34
votes
5 answers
When to use a Service or AsyncTask or Handler?
Can someone tell me the TRUE difference?

TIMEX
- 259,804
- 351
- 777
- 1,080
31
votes
4 answers
Android: Why can't I create a handler in new thread
I had a problem creating a handler in new thread. This is my code:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
new Thread(new…

nguyenbkcse
- 549
- 1
- 10
- 20
31
votes
2 answers
29
votes
3 answers
How handler classes work in Android
I am new to android and was reading the demo applications on official android website. And I came across a method of Handler class named as postDelayed(Runnable r, long milliseconds).
Can anybody please explain what this method does ?

Rajat
- 1,449
- 5
- 20
- 33
28
votes
2 answers
Passing arguments to an event handler
In the below code, I am defining an event handler and would like to access the age and name variable from that without declaring the name and age globally. Is there a way I can say e.age and e.name?
void Test(string name, string age)
{
Process…

user476566
- 1,319
- 3
- 26
- 42
27
votes
1 answer
Where do I create and use ScheduledThreadPoolExecutor, TimerTask, or Handler?
I need to make my RSS Feed reader check the feed every 10 minutes for new posts, and then parse them if there are new ones. I also need to update the UI about every minute.
I have read and heard different things from various sources. My current…

zr00
- 528
- 1
- 7
- 20
26
votes
1 answer
How to catch and re-throw all errors in MySQL
I can't seem to find anywhere how to catch and re-throw any errors or warnings that can occur in a procedure.
What I want is the syntax to do the following:
create procedure myProcedure()
begin
declare exit handler for…

nikdeapen
- 1,581
- 3
- 15
- 27