android - calling ui thread from worker thread

后端 未结 7 2090
再見小時候
再見小時候 2020-12-11 00:12

Hi I want to make Toast available to me no-matter-what and available from any thread whenever I like within my application. So to do this I extended the A

相关标签:
7条回答
  • 2020-12-11 01:17

    What's wrong with runOnUiThread?

    http://developer.android.com/reference/android/app/Activity.html#runOnUiThread(java.lang.Runnable)

    activity.runOnUiThread(new Runnable() {
        public void run() {
            Toast.makeText(activity, "Hello, world!", Toast.LENGTH_SHORT).show();
        }
    });
    
    0 讨论(0)
提交回复
热议问题