这是我的问题 - 我想创建一个活动和一个对话框(带有文本字段和确定按钮)。我想做以下事情:
- 显示 AlertDialog(在创建活动、单击按钮或其他一些操作时);
- 在 AlertDialog 中填写文本,然后单击 OK 按钮;
- 继续做activity的主线程;
像这样的东西:
public String getText() {
String result = null;
// Showing the new window with the text box and the button, and after
// the button is clicked to move to the return statement below;
return result;
}
我尝试使用“runOnUiThread”和“AsyncTask”,但“result”字段上的操作仅在“protected void onPostExecute(Void result)”方法中完成,同时主程序仍在执行,无需等待我的输入.
无论如何要这样做(我相信它有,因为看到了这样的应用程序)来解决这个问题?我知道寻求这样的帮助真的很无礼 - 但是可以编写一些代码示例,看看它是如何真正发生的,因为超过 3 天,我做不到。如果没有,请提供一些建议,并将继续尝试和尝试:) 非常感谢!