A
A
Altf12012-02-23 22:10:28
Android
Altf1, 2012-02-23 22:10:28

[Android] Handling "while pressed" button?

Actually the problem is this, in the application there is data transfer over the network on a timer.
Something like this happens:

Socket s = new Socket(ip, port);<br/>
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(s.getOutputStream()));<br/>
ScheduledExecutorService timer1 = Executors.newSingleThreadScheduledExecutor();<br/>
timer1.scheduleAtFixedRate(new Runnable() {<br/>
public void run() {<br/>
out.write(&quot;default message&quot;);<br/>
out.flush();<br/>
}<br/>
}, 10, Long.parseLong(&quot;100&quot;), TimeUnit.MILLISECONDS);<br/>

How to properly handle the situation - "while the button is pressed, do out.write("some message"); if it is pressed, then do out.write("default message"); next"
In the standard handlers, I found only OnClick and OnLongClick, both are not suitable.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
m08pvv, 2012-02-23
@m08pvv

stackoverflow.com/questions/3784514/capture-button-release-in-android

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question