listener

How can I register several listeners on item click at ListView?

I have ListView, where any item is HorizontalLayout on wchich there are 3 TextView. I can realize interface AdapterView.OnItemClickListener: public void onItemClick(AdapterView parent, View view, final int position, long id) { final long iid = this.id; new Thread( new Runnable() { pub...

ExtJS listeners: anonymous function parameters

I grabbed this code form some book I've bumped on the InternetS... sm: new Ext.grid.RowSelectionModel({ singleSelect: true, listeners: { rowselect: { fn: function(sm,index,record) { Ext.Msg.alert('You Selected',record.data.title); } } } }); now, sm is shorthand for selection...

when a setOnTouchListener is set to webview - loadDataWithBaseURL does not work or shows the same old content

I am loading some sequence of pages while the user swipes/flings on the webview, using the animation effect of the viewflipper - to bring that iphone transition effect. I have two webviews added to a viewflipper. Added setOnTouchListener to both the webviews and using gesture detector for fling. After detecting the fling direction, I ...

How to create on click event for children in Expandable list.

Hello. I am playing around with this example. http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/ExpandableList2.html I cannot figure out how to attach a listener to the children elements so that I can trigger some action when the user taps on the phone number. Any code or links would be greatly ...

Java - Should ActionListeners, KeyListeners, Etc, Always Be Declared In Inner Classes?

Hi coders, In all the Java source code examples I have looked at the listeners have always been declared in inner classes. Why - what is the reason for coding the classes like this instead of having the listener(s) in their own seperate *.java file \ class? Would having seperate classes for the listeners be considered a bad design? I...

How to avoid setting inline onClickListner in getView()

I was asked to refactor the getView() code presented below. I have got ListView with custom Adapter. Every row contains clickable buttons and texts. At the moment onClickListeners are set in the body of getView(), this is quite insane idea, because this method is called very frequently. Inside of every onClick function I need access to...

Should one use an Activity or a Service when using a button in a Widget?

I'm been trying to figure this out for a while now, and have just become more and more confused. I have made a Android Widget which displays two articles (title + image). In addition to this, I have buttons for flipping backward and forward through the articles. What I don't understand is how I can change the Widgets RemoteViews when th...

Intercepting download in webview and downloading using HttpClient

Hi, 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...

The quintessential email listener / mini server in Java or .NET

I'm embarrased of how I'm unaware of SMTP / POP3 / IMAP protocols, as much as I thought I know HTTP and TCP/IP it apears that I took email as granted, and never had to write any piece of code that will do other than sending an email via an existing SMTP server. My task is to write an incomming email channel and I would like to hear what...

Asynchronous Listening on class that launched asynchronous process

SOLVED VERSION Ok so here it is. I am not even sure how to properly ask the question. I am creating a form that pops up within a program asynchronously so that it doesn't interfere with the main program. Within this form, I want to display data that comes from the "base class", in this example, it's the Metronome class. The Metronome c...

Java: What's the difference between ActionEvent and ItemEvent on a JRadioButton?

They're both raised once after the mouse button is released and both can have all the information available on the JRadioButton right? Is there any difference? ...

C# Tcp Listener to accept multiple connections but not get flooded?

Hi, I am creating my first app its a little server. I just wanted to know whats the best way to accept multiple connections but not be flooded, say 10 connections in 10 secounds then if flooded close the listener. Would threads or thread pool help me do this. I added the Threadpool but not sure on how i should be using it for my applic...

Android long-touch event

I have two buttons that increment and decrement a value by one with each press and they're working just fine with the onClickListener. I see that an onLongClickListener exists, which I assume is for touch and hold events. How would I have the number rapidly increment/decrement if the button is held? Am I correct in assuming that onLongC...

Listening for action on internal JPanel from a JFrame

Hi, I have a JFrame that has a BottomPanel (a class I made that extends JPanel) inside it. And inside that JPanel is another JPanel called DicePanel(that again extends JPanel). In DicePanel there is a button called 'End Turn' that when clicked should end the players current turn for the board game the program is based on. I want to some...

Is there an ANT task for watching a directory for changes?

It sounds a little far fetched to me, but is there an ANT task for watching a directory for changes and then running a particular ANT class when the directory changes? ...

Android OnLongClickListener strange / unreliable behaviour

Hi there :) I'm currently fighting against the OnLongClickListener on Android Api Lvl 8. Take this code: this.webView.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { System.out.println("long click"); return true; } }); It works perfectly. I can press anywh...

In Java/Swing, is there a way to legally "attempt to mutate in notification"?

Hi folks, I was wondering if there is some sort of magic I can use to get around an IllegalStateException and allow a JTextField to "attempt to mutate in notification", or in other words to set its own text if its listener is triggered. For your information, I am trying to program an auto-complete function which returns the most likel...

Linq for NHibernate Event Listener

I have an implementation of IPostLoadEventListener which converts DateTime properties from UTC in our database to the user's local time zone. This works fine when working with NHibernate entities using Session.Get, but I can't find a way to get Linq for Nhibernate to observe the event listener, which means the DateTime properties on any...

Can A Listener Trigger An InterruptedException?

Hi I was just wondering if I have a touchscreen device that has an onTouchListener, will current execution of a method switch immediately to that listener method when the screen is touched, and could this be used to trigger an interrupted exception of a try catch block. For example, if I have a method that does something and then reduc...

Is it possible to configure non-global listeners declaratively?

Is it possible to configure (registering with scheduler) non-global job listeners declaratively in properties file (rather than programmatically) similar to configuring global listeners? Check here for: Programmatically adding a global job listener Programmatically adding a non-global job listener EDIT: Example for configuring a Glo...