これはおそらくこれまでで最もばかげた質問の 1 つだと思いますが、私の頭はおかしいようです。vCard から文字列を作成するこのメソッドがあります。
public static String process(String vCard) {
ArrayList<ArrayList<String>> vCardData = parseData(vCard);
if (vCardData != null) {
StringBuilder readableVCard = new StringBuilder();
for (int i = 0; i < FIELD_COUNT; i++) {
ArrayList<String> vCardDataField = vCardData.get(i);
if (vCardDataField.size() > 0) {
String field = null;
if (i == FORMATTED_NAME) {
field = "Name: ";
} else if (i == PHONE_MOBILE) {
field = "Phone (mobile): ";
} else if (i == PHONE_HOME) {
field = "Phone (home): ";
} else if (i == PHONE_WORK) {
field = "Phone (work): ";
} else if (i == PHONE) {
field = "Phone: ";
} else if (i == FAX_HOME) {
field = "Fax (home): ";
} else if (i == FAX_WORK) {
field = "Fax (work): ";
} else if (i == PAGER) {
field = "Pager: ";
} else if (i == EMAIL_HOME) {
field = "Email (home): ";
} else if (i == EMAIL_WORK) {
field = "Email (work): ";
} else if (i == EMAIL) {
field = "Email: ";
} else if (i == ORGANISATION) {
field = "Company: ";
} else if (i == JOB_TITLE) {
field = "Job title: ";
} else if (i == ADDRESS_HOME) {
field = "Address (home): ";
} else if (i == ADDRESS_WORK) {
field = "Address (work): ";
} else if (i == ADDRESS) {
field = "Address: ";
} else if (i == IM_SKYPE) {
field = "Skype: ";
} else if (i == IM_GOOGLE) {
field = "Google Talk: ";
} else if (i == IM_JABBER) {
field = "Jabber: ";
} else if (i == IM_YAHOO) {
field = "Yahoo: ";
} else if (i == IM_MSN) {
field = "MSN: ";
} else if (i == IM_ICQ) {
field = "ICQ: ";
} else if (i == IM_AIM) {
field = "AIM: ";
} else if (i == TWITTER) {
field = "Twitter: ";
} else if (i == BIRTHDAY) {
field = "Birthday: ";
} else if (i == ANNIVERSARY) {
field = "Anniversary: ";
} else if (i == NOTES) {
field = "Notes: ";
} else if (i == WEBSITE) {
field = "Website: ";
} else {
continue;
}
if (readableVCard.length() != 0) {
readableVCard.append("\n");
}
readableVCard.append(field);
for (int j = 0; j < vCardDataField.size(); j++) {
if (j != 0) {
readableVCard.append("; ");
}
readableVCard.append(vCardDataField.get(j));
}
}
}
if (readableVCard.length() != 0) {
String textVCard = readableVCard.toString();
try {
textVCard = qpDecoder.decode(readableVCard.toString());
} catch (Exception e) {
Logger.e("VCard to UTF-8", e.getMessage());
}
return (textVCard);
}
}
return (null);
}
したがって、私の現在の出力は次のようになります。
Name: Marko
Phone(mobile):1312
Phone(fax):441231
Phone(home):543534
Email(home):dddd
Email(work):eeee
Email(other):aaaa
私が望むのは、グループ (名前/電話/メール) の間に改行を追加することです。そのため、次のような結果が得られます。
Name: Marko
Phone(mobile):1312
Phone(fax):441231
Phone(home):543534
Email(home):dddd
Email(work):eeee
Email(other):aaaa
Addressblablabla
.
.
.
IMsblablabla
.
.
.
誰か助けてくれませんか?ありがとう。