我尝试在具有不同布局但 TextView 上的文本没有改变的对话框上设置 TextView。我为此目的使用该代码:
public void onDialogPositiveClick(DialogFragment dialog) {
EditText et=(EditText)dialog.getDialog().findViewById(R.id.editText1);
dosyaAdi=et.getText().toString();
TextView txv=(TextView) dialog.getDialog().findViewById(R.id.header);
txv.setText(parametre);
if(dosyaIslemi){
generateFeatures kayit=new generateFeatures(this,dosyaAdi);
}
else{
generateFeatures kayit=new generateFeatures(this,dosyaAdi);
}
sm.registerListener(this, myAccelerometer,50000);
}