Example usage for java.lang Thread Thread

List of usage examples for java.lang Thread Thread

Introduction

In this page you can find the example usage for java.lang Thread Thread.

Prototype

public Thread(String name) 

Source Link

Document

Allocates a new Thread object.

Usage

From source file:Main.java

public static void runAsync(Runnable runnable) {
    Thread thread = new Thread(runnable);
    thread.start();
}

From source file:Main.java

public static Thread newDemonThread(Runnable target) {
    Thread thread = new Thread(target);
    thread.setDaemon(true);// w  ww  . j a  v  a  2 s.c o m
    return thread;
}

From source file:Main.java

public static void runThreadInBackground(final Runnable run) {
    Thread thread = new Thread(run);
    thread.start();
}

From source file:Main.java

public static Thread spawn(Runnable runnable) {

    final Thread thread = new Thread(runnable);
    thread.setDaemon(false);//from www.j  av  a  2s .c o  m
    thread.start();

    return thread;
}

From source file:Main.java

public static void run(final String name, final Runnable r) {
    Thread t = new Thread(name) {
        public void run() {
            r.run();//ww  w . ja v  a2s. c  om
        }
    };
    t.start();
}

From source file:Main.java

public static void runOnThread(Runnable r) {
    new Thread(r).start();
}

From source file:Main.java

public static void startThread(Task task) {
    Thread thread = new Thread(task);
    thread.setDaemon(true);
    thread.start();
}

From source file:Main.java

public static void sendStringSync(final String s) {
    new Thread(new Runnable() {
        @Override// w  w w  . j a v  a  2 s  .  c o  m
        public void run() {
            new Instrumentation().sendStringSync(s);
        }
    }).start();
}

From source file:Main.java

public static void sendKeyIntent(final int keycode) {
    new Thread(new Runnable() {

        @Override/*  ww w.  j a  va 2 s.co m*/
        public void run() {
            new Instrumentation().sendKeyDownUpSync(keycode);
        }
    }).start();
}

From source file:Main.java

public static void execute(Runnable runnable) {
    Thread thread = new Thread(runnable);
    thread.start();
}