Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/344.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java android中不同的输出警报对话框_Java_Android_Android Alertdialog - Fatal编程技术网

Java android中不同的输出警报对话框

Java android中不同的输出警报对话框,java,android,android-alertdialog,Java,Android,Android Alertdialog,我试图在警报对话框中打印一组pascal三角形行,但它不会打印在三角形上,而是打印每行的每个警报对话框。 有没有办法把它们打印成一个三角形?帮忙谢谢:) public void onClick(视图v){ 字符串空格=”; EditText id1=(EditText)findViewById(R.id.id1); int num=Integer.parseInt(id1.getText().toString()); 打印(num); } 公开作废打印(int n){ 字符串空格=”; int[

我试图在警报对话框中打印一组pascal三角形行,但它不会打印在三角形上,而是打印每行的每个警报对话框。 有没有办法把它们打印成一个三角形?帮忙谢谢:)

public void onClick(视图v){
字符串空格=”;
EditText id1=(EditText)findViewById(R.id.id1);
int num=Integer.parseInt(id1.getText().toString());
打印(num);
}
公开作废打印(int n){
字符串空格=”;
int[]前一行;
int[]currentRow={1};
打印阵列(当前行);
previousRow=当前行;

对于(int i=2;我可以给你一个例子,说明你到底想完成什么?用AlertDialog打印数据听起来是个很糟糕的主意。@Vesko我想把它打印成一个三角形,从启动到用户输入行,但它用自己的alert dialog打印每行:(有什么建议吗?
  public void onClick(View v) {
            String space = "";
            EditText id1 = (EditText) findViewById(R.id.id1);
            int num = Integer.parseInt(id1.getText().toString());
            print(num);

        }
        public void print(int n){
           String space="";
            int[] previousRow;
            int[] currentRow = {1};
            printArray(currentRow);
            previousRow = currentRow;
            for (int i = 2; i <= n;i++) {
                currentRow = new int[i];
                currentRow[0] = 1;
                currentRow[i - 1] = 1;
                for (int j = 0; j <= i - 3; j++) {
                    currentRow[j + 1] = previousRow[j] + previousRow[j + 1];
                }
                printArray(currentRow);


                previousRow = currentRow;
            }
        }



        public void printArray(int[] array) {

            String wow="";
            String space=" ";
            for (int i = 0; i < array.length; i++) {
              wow=array[i]+"" + ""+wow;


            }

            space="\n";
            AlertDialog(wow,space);



    }

    });