我想在電子郵件正文中發送一個具有某些值的ArrayList。 像這樣:如何在Android中發送電子郵件正文中的ArrayList?
Button bt_send = (Button) findViewById(R.id.bt_cadastrar_medicos);
bt_cadastrar_medicos.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("plain/text");
intent.putExtra(Intent.EXTRA_EMAIL, "[email protected]");
intent.putExtra(Intent.EXTRA_SUBJECT, "SUBJECT");
ArrayList<String> array = new ArrayList<String>();
for(int i=0; i<2; i++){
String ii = String.valueOf(i);
niveis.add(ii);
niveis.add(ii);
intent.putExtra(Intent.EXTRA_TEXT, niveis.get(i));
}
startActivity(Intent.createChooser(intent, "Choose the app to send:"));
}
});
這只是一個例子,其實我想添加在陣列位置值,從一個Java類的獲取。但在身體中,只有最後一個值出現,在這種情況下將是「2」。
如何在身體中顯示所有人?那可能嗎?
謝謝。
哇,我的代碼中缺少我的Arraylist中的「to string」。並且使用你也是代碼。謝謝。 – user2600853