消息对话框在运行时插入文本

时间:2012-01-07 17:32:03

标签: android dialog message

我有一个Xml文件作为消息对话框。 在其中我有TextView。 我在MyAcivity中使用此程序来激活和创建对话框。

protected void displayAllertBox() {
    if (dialog1==null)
    showDialog(ALLERT_DIALOG);
}



@Override
protected Dialog onCreateDialog(int id) {
    switch (id) {
    case ABOUT_DIALOG:
------ NOT important 
        return dialog;

    case ALLERT_DIALOG:
        AlertDialog.Builder builder1;

        LayoutInflater inflater1 = (LayoutInflater) mContext
                .getSystemService(LAYOUT_INFLATER_SERVICE);
        View layout1 = inflater1.inflate(R.layout.windmessage,
                (ViewGroup) findViewById(R.id.layout_root));

        builder1 = new AlertDialog.Builder(mContext);
        builder1.setView(layout1);
        builder1.setMessage("http://www.limelect.com").setPositiveButton(
                this.getString(R.string.ok),
                new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int id) {
                        dialog.cancel();
                    }
                });

        dialog1 = builder1.create();
/*          TextView KT=    (TextView)findViewById(R.id.KnotText);
        KT.setText("Knots   "+Integer.toString( Speed[29]));

*/
        return dialog1;

    default:
        return null;
    }
}

我的问题是 R.id.KnotText是我需要在运行时将文本放入的文本消息 我明白了  KT= null 我认为create会给我插入文本的可能性 那怎么办呢?

0 个答案:

没有答案
相关问题