• 7
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

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]]
  • 121
Reply Report

Try this :

for (int i = 0; i < arr.length; i++) {
   Log.d(TAG, arr[i]);
}

What we are doing here is iterating over the array using the for loop to print logcat. Log cat output can be done with Log.d(..), Log.v(..) , Log.i(..) or Log.e(..). See more here.

  • 0
Reply Report