Print the large string values in android log cat.

Hi,

Have a happy Monday.

In Android, sometimes we need to print the large numbers of strings value in log. But log can't accept whole value of the string.

In this case, we need to split the logs. It's very simple android code, I attached below this blog.

public static void logLargeString(String TAG, String msg) {
        if (str.length() > 3000) {
            Log.i(TAG, msg.substring(0, 3000));
            logLargeString(TAG, msg.substring(3000));
        } else {
            Log.i(TAG, msg);
        }
}

Just use it and enjoy...

Comments

Popular posts from this blog

Clear the app data programmatically in android

convert an integer to a string in java