Skip to content Skip to sidebar Skip to footer

Thread Calling In Android

I am working on an Android Application where I need to work on thread which is a well known concept of Java. I am having a thread named 'thrd' in my application and I want to call

Solution 1:

Threads are just Java object, so you need a thread reference on the thread you want to start. I think it's impossible (or not a good idea if possible) to get such a reference form a thread name. Here is code sample to get started with threads:

// This class extends Thread class 
BasicThread1 extends Thread { 
     // This method is called when the thread runs 
      public void run() { 
        // Your code here
      } 
} 

// Create and start the thread 
Thread thread = new BasicThread1(); 
thread.start(); 

Post a Comment for "Thread Calling In Android"