By following the answer here: How to know if other threads have finished?
I manage to build a listener for a thread like so:
NotifyingThread prcoessCatRegThread = new processCatFromPage(baseURL, 0, null);
prcoessCatRegThread.addListener(this);
prcoessCatRegThread.start();
@Override
public void notifyOfThreadComplete(NotifyingThread notifyingThread) {
// TODO Auto-generated method stub
System.out.println("Thread calledback returned.");
System.out.println(notifyingThread);
}
And the "processCatFromPage" Class:
class processCatFromPage extends NotifyingThread{
int fromPage = 0;
Integer toPage = 0;
int cat = 0;
String baseURL = null;
static List<Posts> Posts = new ArrayList<Posts>();
private void processPage(int pageNum){
}
processCatFromPage(String baseURL, int fromPage, Integer toPage){
}
@Override
public void doRun() {
processPage(fromPage);
}
}
Now i try to access "Posts" from the "processCatFromPage" class in the "notifyOfThreadComplete", when debugging in eclipse i can see the variable, but i dont know how can i access to it..
notifyingThread.Posts
Comesup with an error.. and so any other method i tryed..
Any help?
Many Thanks!:)
The variable i try to acess trough the code: https://i.stack.imgur.com/dWwgY.png