【发布时间】:2017-09-04 10:55:01
【问题描述】:
问题很简单 我想在方法的开头显示一个(消息)toast 以等待
private void PartitionShow () {Toast.makeText (getApplicationContext (), "wait processing ...", Toast.LENGTH_LONG) .show ();// the code of my method// ...}
只有这条消息只出现在我的方法代码的末尾
一个可行的解决方案是将代码放在一个类中:
private class DownloadFilesTask extends AsyncTask <String, Integer, String> {}
并在以下位置管理吐司:
protected void onProgressUpdate (Integer ... progress) {}
有兴趣的朋友请看sample code
仅在我的代码中创建对象,将其放置在另一个独立线程中会变得沉重且缓慢
感谢那些会为我找到更简单的解决方案的人?
【问题讨论】:
-
“等待”是什么意思?
-
为什么不用进度条?
标签: android methods show toast