My problem is that I have two async tasks which doing a kind of matrix multiplications. Therefore both tasks are accessing the same matrix. One the upper part, the other the lower part. For memory saving issues I use ArrayLists and delete entries which I do not need longer. The problem is that in both tasks there is for loop runing and at the end of this loop it should wait for the other task. But I do not know how to do this. Task 1:
protected Void doInBackground(Void... paramArrayOfParams) {
        android.os.Debug.waitForDebugger();
        for(j=1; j<(size+1); j++)
        {
            .... 
            try{ othertask.wait();
            }catch(InterruptedException e){}
            //wait for other task();
        }
Task 2:
protected Void doInBackground(Void... paramArrayOfParams) {
            android.os.Debug.waitForDebugger();
            for(j=1; j<(size+1); j++)
            {
                ....
                notifyAll();
                //notifythatroundisfinished();
            }
I tried to use notify and wait, but it seems that this is not solving the issue. I do not know any additional methods which I could use to solve the issue. Is it actually possible to wait two for the other task while both are running?
 
     
     
    