I want to run two threads r1
, and r2
. First start the r1
and after completion of r1
, start r2
(only after the completion r1
). How can this be done, two threads, one after another?
Asked
Active
Viewed 1.3k times
5

Whymarrh
- 13,139
- 14
- 57
- 108

Ramakrishna
- 4,066
- 16
- 48
- 72
-
can u plz post your code that what had you done till now – ingsaurabh Feb 03 '11 at 10:40
4 Answers
6
My answer here has an example using a Thread
and a Handler
. This method might be useful if you wanted to perform some UI updates in between the threads running.
1
Why don't you do all the tasks you want in one single thread? This way they will be "naturally" one after the other.
The way to implement this depends on what type of tasks you want to do and how you pass them the information they require to start.

Pedro Loureiro
- 11,436
- 2
- 31
- 37
-3
- Make a Boolean variable with initially false
- Start the first thread
- After completion of the entire 1st thread execution make the Boolean value to true
- Don't start second thread util/unless the flag becomes true

Furqan Safdar
- 16,260
- 13
- 59
- 93

padmini
- 7