Are methods called from a separate thread, run on the calling thread?
I've been using threads for 2-3 days now, and I've got a quick question
regarding methods. I'm making an Android application and it starts off
with the main UI thread (let's call it the "UI Thread" for clarity). I'm
spawning a new thread using the following code:
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
someMethod();
}
});
thread.start();
My question is, will someMethod() also run on the new thread that I just
created because I'm calling it from there? Or will it run on the UI
thread? For reference, someMethod() is located outside outside of the
method that's creating the new thread.
If someMethod() won't run on the new thread, how do I make it do so? Thanks.
No comments:
Post a Comment