我如何从一个线程显示吐司消息?
How can I display Toast messages from a thread?
您可以通过调用活动
的 runOnUiThread 从你的线程的方法:
You can do it by calling an Activity
's runOnUiThread
method from your thread:
activity.runOnUiThread(new Runnable() {
public void run() {
Toast.makeText(activity, "Hello", Toast.LENGTH_SHORT).show();
}
});