我正在使用以下代码:
//(...)
translationTextView.setText("Searching for translation...");
translationTextView.setVisibility(View.VISIBLE);
myAsyncTask = (MyAsyncTask) new MyAsyncTask().execute(someString);
try {
//As I understand it should wait here until AsyncTask is completed. But why for the time of execution translateTextView value is ""?
translationTextView.setText(translateTask.get() + "<BR>");
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ExecutionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
问题是translationTextView
值是“”,直到myAsyncTask
完成。所以看起来像
translationTextView.setText("Searching for translation...");
不叫。我做错了什么?