点击按钮弹出dialog,在dialog中有一个listview
自定义view,有一个listview
setAdapter的时候异常。
或者设置text.setText的时候也是异常。
请问下,这个问题有什么办法能解决。

解决方案 »

  1.   

    在protected void onPrepareDialog(int id, Dialog dialog) 中使用TextView aaa = (TextView)dialog.findViewById(R.id.sss);
    注意红色字体部分。
      

  2.   


    我用的AlertDialog.Builder dialog 在方法里写过后,没有变化啊
      

  3.   


    private Dialog setUpDialog(Context context){
    LayoutInflater inflater = getLayoutInflater();
    final View view = inflater.inflate(R.layout.dialog, null);
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setTitle("Title")
    .setView(view)
    .setPositiveButton("OK", new DialogInterface.OnClickListener() {

    public void onClick(DialogInterface dialog, int which) {
    // TODO Auto-generated method stub
    }
    })
    return builder.create();
    }在R.id.dialog里布局,应该没问题的,多尝试下
      

  4.   


    我在按钮的单击事件里写的,,,代码按照你得写的。 重写的方法, 我也是实现了  [javacode]
    protected void onPrepareDialog(int id, Dialog dialog) {
    // TODO Auto-generated method stub
    TextView t = (TextView)dialog.findViewById(R.id.caidan_table);
    t.setText(Table.table);
    super.onPrepareDialog(id, dialog);
    }
    [/javacode]