question about listener..
hello,
I have built a class (class A )that implemented an interface that has a listener method called
public void onDataIncoming(String str);
I coded the onDataIncoming method as follow :
Note : String incoming, a global variable
publicvoid onDataIncoming(String str)
{
incoming = incoming + str;
}
so, basically I append the data i received into the incoming variable. And the rate of incoming data is very fast, and keeps on coming in...
Then I have another class (class B )that runs an independent thread. I let this thread runs continuosly, and after every 100 miliseconds, it will call a method in class A. This method is as follows:
public String processIncoming()
{
String temp = incoming;
incoming ="";
return temp;
}
Due to the early design of my program, i have to mearge 2 different functions in my programs. Its difficult for me to make too much changes to my code.
So, my question is, base on what I have implemented, will the codes gives me problem in the long run. It runs well so far though...
thanks..
Message was edited by:
a35176

