我有以下AsyncTask
public class LoadFromCloudTask extends AsyncTask<Void, String, Boolean> {
public LoadFromCloudTask(LoadFromCloudTaskFragment loadFromCloudTaskFragment) {
this.loadFromCloudTaskFragment = loadFromCloudTaskFragment;
}
@Override
protected Boolean doInBackground(Void... params) {
...
...
...
// How possible I can halt my execution, prompt for user input, and continue execution based on user input.
// In Swing, I can ...
//
/*
// Hold the execution, and prompt for user input
final int result = JOptionPane.showConfirmDialog(LoadFromCloudJDialog.this, message, MessagesBundle.getString("question_title_overwrite_your_data_by_cloud_data_at"), JOptionPane.YES_NO_OPTION);
// Continue execution based on user input.
*/
}
}
我想知道,是否可以停止 AsyncTask 执行,提示用户输入并根据用户输入继续执行?
在 Swing 中,我可以通过简单地使用JOptionPane.showConfirmDialog
. 安卓呢?