1
當我嘗試將程序的結果設置爲對話框中的textView時,app force關閉。我通過鏈接一個帶有textview的xml來創建對話框,這是我嘗試更新的這個textview。將AlertDialog的TextView更新結果Android
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();