Page 1 of 1
disply',' if title is empty?
Posted: Tue Oct 29, 2013 1:40 am
by oldman1881
checked title field i am sure it is empty and no space.
suggest to trim the title filed before put ','
Re: disply',' if title is empty?
Posted: Tue Oct 29, 2013 2:40 am
by devin
Code: Select all
if (TextUtils.isEmpty(company)) {
combined = displayNameIsOrganization ? null : title;
} else {
if (TextUtils.isEmpty(title)) {
combined = displayNameIsOrganization ? null : company;
} else {
if (displayNameIsOrganization) {
combined = title;
} else {
combined = context.getString(
R.string.organization_company_and_title, company, title);
}
}
}
Hello, this is the code, which title has been determined is empty. Only when the title contains a space will cause you mentioned. Maybe your contacts is a merge contacts. In one account he was not edited in the phone. But it contains spaces.
Re: disply',' if title is empty?
Posted: Tue Oct 29, 2013 5:53 am
by oldman1881
呵呵,n多年没有做coding了。不知道android里有没有trim这样的功能,就是如果有一个string :space+space+ABC+space+space,trim以后就只有ABC了,可以把space弄掉。 这样就不会遗留一个空白的space的问题。
Re: disply',' if title is empty?
Posted: Thu Oct 31, 2013 1:39 am
by devin
这里没有使用trim。只是判断String是否为空。因此有空格会导致“,”出现。我之前是这样回答的。
Re: disply',' if title is empty?
Posted: Thu Oct 31, 2013 5:36 am
by oldman1881
建议使用trim,以前做coding的时候,我们判断string都是先trim一下,再判断的,不然A和A+space会不一样。
Re: disply',' if title is empty?
Posted: Fri Nov 01, 2013 1:30 am
by devin
恩谢谢!有较多联系人出现这个情况吗?如果是个别建议修改一下联系人。因为是手机我想减少不必要的代码。
Re: disply',' if title is empty?
Posted: Sat Nov 02, 2013 7:07 am
by oldman1881
devin wrote:恩谢谢!有较多联系人出现这个情况吗?如果是个别建议修改一下联系人。因为是手机我想减少不必要的代码。
不是很多,是大多联系人有这个问题,因为大多都联络人是只有公司,没有职位。
所以至少这段码用trim处理一下。
Re: disply',' if title is empty?
Posted: Mon Nov 04, 2013 2:05 am
by devin
好的,但是在我的手机没有这个问题。因为当联系人没有职位,相关的字段将是空,而不是空格。
Re: disply',' if title is empty?
Posted: Tue Nov 05, 2013 11:14 am
by oldman1881
devin wrote:好的,但是在我的手机没有这个问题。因为当联系人没有职位,相关的字段将是空,而不是空格。
其实应该是空的,不知道为什么会是空格。
Re: disply',' if title is empty?
Posted: Thu Nov 07, 2013 7:33 am
by devin
Re: disply',' if title is empty?
Posted: Sun Nov 10, 2013 4:11 am
by oldman1881
ok了,谢谢。
不过backup和restore还是要手改文件路径,可否像settting restore一样有file browser功能,可以自己选。
Re: disply',' if title is empty?
Posted: Mon Nov 11, 2013 2:53 am
by devin
好的,我试试
Re: disply',' if title is empty?
Posted: Thu Nov 21, 2013 12:02 pm
by oldman1881
using test version now, not sure why it has 'system not responding' problem very often.
do you know why?
Re: disply',' if title is empty?
Posted: Fri Nov 22, 2013 1:11 am
by devin
What is the function you are using?
Please try this final version.
http://www.dw-p.net/dl/DW-Contacts-Phone.apk
Re: disply',' if title is empty?
Posted: Sat Nov 23, 2013 12:13 pm
by oldman1881
I donot use any complicate function, just start dialer, then the system show me unresponding and it is very often.
Re: disply',' if title is empty?
Posted: Sat Nov 23, 2013 12:14 pm
by oldman1881
I donot use any complicate function, just start dialer, then the system show me unresponding and it is very often.
Re: disply',' if title is empty?
Posted: Mon Nov 25, 2013 2:04 am
by devin