Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7307937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T23:29:22+00:00 2026-05-28T23:29:22+00:00

I would like to log raw data like arrays in my logcat, so I

  • 0

I would like to log raw data like arrays in my logcat, so I know what is the output.
Lets say I have an array… like that:

File[] mp3List = ...
Log.v("test", mp3List);

Why can’t I just log the array to console? How can I do it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T23:29:22+00:00Added an answer on May 28, 2026 at 11:29 pm

    The reason why this doesn’t work is simply because the 2nd argument of Log.v is a String not a File[]. Java strictly enforces argument types.

    Update:

    You can easily transform the information contained a File object into a String object. All java objects implement a toString(), which if I remember correctly returns a combination of the ClassName and the address of the object is located. However this usually doesn’t contain useful information. So you need to define the conversion yourself.

    Now to convert from File[] to String is more complicated because you when call a method on an array it works on the array object rather than on members of an array (which contains the information I suspect you care about). So calling mp3List.toString() will return a single string that describes the array object and not the information contained in the array.

    So you’ll probably want to write a method like this:

    String fileArrayToString(File[] f){
        String output = "";
        String delimiter = "\n" // Can be new line \n tab \t etc...
        for (int i=0; i<f.length; i++)
        {
            output = output + f[i].getPath() + delimiter;
        }
    
        return output;
    }
    

    And then call make your log call as follows:

    Log.v("MyTag", fileArraytoString(mp3List);
    

    However this might be hard to read.

    I personally would do it like this:

    for (int i=0; i<mp3List.legnth; i++)
        Log.v("MyTag", Integer.toString(i) + ":" + mp3List[i].getPath());
    

    Its simpler, produces cleaner log messages and is easier to understand what is going on as a programmer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to monitor a log file that is being written to by
I would like to log data to a file in 2 byte languages (chinese,
I would like to log output test data when running test with the Silverlight
I would like to set the log file name for a log4j and log4net
I would like to create a class that creates and manages log files. I
I would like to know how to log the login and logout of a
I have a web application and would like to log to different files depending
I would like to log all the output of a Python script. I tried:
I would like to write into a log file from the kernel space. I
I would like to log all SQL statements that access a specific or a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.