Activity.runOnUiThread()

作者:追风剑情 发布于:2015-1-24 12:37 分类:Android

从工作线程中更新UI需要用到此API

runOnUiThread(new Runnable()    
{    
            public void run()    
            {    
            	Context context = getApplicationContext();
            	CharSequence text = "Hello toast!";
            	int duration = Toast.LENGTH_LONG;
            	Toast toast = Toast.makeText(context, text, duration);
            	toast.show();
            }    
});    

标签: Android

Powered by emlog  蜀ICP备18021003号-1   sitemap

川公网安备 51019002001593号