运行runable阻塞线程

推荐安卓开发神器(里面有各种UI特效和android代码库实例)

MyRun aa = new MyRun ();
new Thread(aa).start();
//new Thread(aa).run(); 会阻塞线程

 

class MyRun implements Runnable{

		public void run() {
			try {
				Log.e("MyRun ","in");
				Thread.sleep(5000);
				Log.e("MyRun ", "out");
			} catch (InterruptedException e) {
								e.printStackTrace();
			}
		}
		
	}

 

你可能感兴趣的:(java,thread)