print array in the log cat android [closed]

You can use Arrays.toString

Log.d("this is my array", "arr: " + Arrays.toString(arr));
// or
System.out.println("arr: " + Arrays.toString(arr));

Or, if your array is multidimensional, use Arrays.deepToString()

String[][] x = new String[][] {
    new String[] { "foo", "bar" },
    new String[] { "bazz" }
};
Log.d("this is my deep array", "deep arr: " + Arrays.deepToString(x));
// or
System.out.println("deep arr: " + Arrays.deepToString(x));
// will output: [[foo, bar], [bazz]]

Leave a Comment