Reputation: 1185
I am interested if it's possible to run 2 lines of code simultaniously,
let's say if i have some function funk(); funk1(); so i want them to be executed simultaniusly
Upvotes: 1
Views: 3318
Reputation: 137362
You can use Threads to achieve that easily. No need for separate processes (in most cases)
For example:
//in some method
Thread t1 = new Thread(new Runnable() {
@Override
public void run() {
//function one or whatever
}
});
t1.start();
Thread t2 = new Thread(new Runnable() {
@Override
public void run() {
//function two or whatever
}
});
t2.start();
Upvotes: 4
Reputation: 344
this is the official answer of your question.
http://developer.android.com/guide/topics/fundamentals/processes-and-threads.html
contains simple examples and good definitions.
Upvotes: 0