Log a list of objects
//package org.expressme.wireless.game;
import android.util.Log;
class Main {
private static final String TAG_GAME = "GAME";
public static void log(Object... objs) {
if (objs.length == 0) {
Log.i(TAG_GAME, "");
return;
}
if (objs.length == 1) {
Object o = objs[0];
if (o == null) {
Log.i(TAG_GAME, "(null)");
} else {
String s = o.toString();
int n = s.indexOf('.');
Log.i(n == (-1) ? TAG_GAME : s.substring(0, n), s);
}
return;
}
StringBuilder sb = new StringBuilder(128);
for (Object o : objs) {
sb.append(o == null ? "(null)" : o.toString());
}
String s = sb.toString();
int n = s.indexOf('.');
Log.i(n == (-1) ? TAG_GAME : s.substring(0, n), s);
}
}
Related examples in the same category