我的应用包含2个微调器有数组项。
如何将在微调器中选择的数据发送给其他人发送电子邮件?
spinner_list = (Spinner) findViewById(R.id.spinner);
adapterlist = ArrayAdapter.createFromResource(this, R.array.List, android.R.layout.simple_spinner_item);
spinner_list.setAdapter(adapterlist);
spinner_blok = (Spinner) findViewById(R.id.spinner2);
adapterblok = ArrayAdapter.createFromResource(this, R.array.Blok, android.R.layout.simple_spinner_item);
spinner_blok.setAdapter(adapterblok);
String emailList[] = {"nazrin239@gmail.com"};
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("message/rfc822");
intent.putExtra(Intent.EXTRA_EMAIL, emailList);
intent.putExtra(Intent.EXTRA_SUBJECT, "Email Subject");
intent.putExtra(Intent.EXTRA_TEXT, "Email Text");
startActivity(Intent.createChooser(intent, "Choice email APP"));
}
}
答案 0 :(得分:0)
试试这个
Intent.putExtra("Key", Value);
例如
Intent.putExtra("Name","John")
答案 1 :(得分:0)
使用此行从spinner
中获取所选项目String str=spinner.getSelectedItem().toString();