如何转换在Android或Java中使用此代码,因为它是用Objective C编写的?Alog转换为Java
ALog(@"ERROR: Account with UserId:%@ AccountType:%d AccoundId:%d DOES NOT EXIST!",
account.userId, account.accountType, account.accountId);
如何转换在Android或Java中使用此代码,因为它是用Objective C编写的?Alog转换为Java
ALog(@"ERROR: Account with UserId:%@ AccountType:%d AccoundId:%d DOES NOT EXIST!",
account.userId, account.accountType, account.accountId);
嗯,Android版”我想要做的事情如下:
Log.i("AccountActivity", "Account with UserId: " + userId +
" AccountType: " + accountType +
" AccountId: " + accountId +
" Does not exist.");
这将出现在由活动和级别(本例中为info)格式化的logcat中。可能是这样的:
I/AccountActivity(1234): Account with UserId: {id} AccountType: {type} AccountId: {id} Does not exist.
不知道这是否回答你的问题......到这里看看,寻求更多帮助:http://developer.android.com/guide/developing/debugging/debugging-log.html
看一看的MessageFormat类:
http://docs.oracle.com/javase/1.4.2/docs/api/java/text/MessageFormat.html
而一些日志框架,像log4j的,共享记录或任何你认为最方便
会的Log4j是答案的一部分吗? – 2012-02-02 07:08:28
也许。 http://code.google.com/p/android-logging-log4j/ – dbrank0 2012-02-02 07:11:16