我想在文本消息正文中显示多个值,但是即使 textArray 有值,下面的代码也不显示正文消息。有没有办法通过循环向电子邮件正文添加值?
public void onClick(View v) {
// TODO Auto-generated method stub
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.setType("text/html");
sharingIntent.putExtra(Intent.EXTRA_SUBJECT, "Example");
int sizeOfArray = list.size();
String textArray [] = new String[sizeOfArray];
for(int i = 0;sizeOfArray > i;i++)
{
HashMap<String, String> arrayString = list.get(i);
String user = arrayString.get("user");
String book = arrayString.get("book");
textArray[i] = user + " - " + book;
}
sharingIntent.putExtra(Intent.EXTRA_TEXT, textArray);
startActivity(Intent.createChooser(sharingIntent,"Share using"));
}
});