当我尝试将程序的结果设置为对话框中的 textView 时,应用程序强制关闭。我通过链接具有 textview 的 xml 来制作对话框,而我尝试更新的正是这个 textview。
AlertDialog.Builder alert = new AlertDialog.Builder(this);
LayoutInflater factory = LayoutInflater.from(this);
resultOne=(TextView)findViewById(R.id.resultOne); //resultone is a textview in xml dialog
resultOne.setText("hello"); //this code is making the app close
final View textEntryView = factory.inflate(R.layout.dialog, null);
alert.setView(textEntryView);
alert.show();