Hi,
Having trouble with this exception. It was introduced for Android 3.0+ and it means it will not allow any network activity using Web.Get or Got on the main thread. So the Web component activity needs to be on another thread.
How to get around this? If I put Web.Got in another thread how can I then register the despatchEvent:
if (component.equals(web1) && eventName.equals(Events.GOT_TEXT)) {
gotText(args[0].toString(), Convert.Int(args[1]), args[2].toString(), args[3].toString());
return true;
}
It will not work if I try to register the above despatchEvent in another Thread, e.g.
Thread thread = new Thread(new Runnable(){
@Override
public void run() {
try {
//Your code goes here
//How to register a GOT_TEXT event here??
} catch (Exception e) {
e.printStackTrace();
}
}
});
I tried ThreadTimer too, but if the timer does not go off at exactly the same time as the GOT_TEXT despatchEvent then it will not work, or so it would appear.
Any ideas?
(Potential feature request: Could the Web component automatically be moved to another thread in the bridge jar files?)
S