下一个代码捕捉到自定义对话框类中的视图覆盖覆盖提醒对话框 : @ info: whatsthis
class example extends Activity{
private void onClick_show_dialog( View v )
{
LayoutInflater lainf = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final View frmFileSystem = lainf.inflate(R.layout.dlg_filesystem, (ViewGroup) findViewById(R.id.lilaFileSystem));
dlg_filesystem = new DlgFileSystem(this);
dlg_filesystem.setView(frmFileSystem);
dlg_filesystem.setCancelable(true);
dlg_filesystem.setButton( aceptar , new DialogInterface.OnClickListener() { public void onClick( DialogInterface dialog, int which )
{
alert( dlg_filesystem.prueba );
}});
dlg_filesystem.setButton2( cancelar , new DialogInterface.OnClickListener() { public void onClick( DialogInterface dialog, int which )
{
}});
dlg_filesystem.show();
}
}
和
public class DlgFileSystem extends AlertDialog{
public String prueba;
private Context context;
private View frmFileSystem;
public DlgFileSystem(Context context)
{
super(context);
this.context = context;
}
@Override
public void setView( View frmFileSystem )
{
super.setView(frmFileSystem);
this.frmFileSystem = frmFileSystem;
TextView txprueba = (TextView)frmFileSystem.findViewById(R.id.txPrueba);
txprueba.setText("adios");
}
}