private void buildEmailText() {
if (box1.isChecked()) emailText += "\nCoca-Cola";
if (box2.isChecked()) emailText += "\nFanta";
if (box3.isChecked()) emailText += "\nInca Cola";
来自一项活动
if (box4.isChecked()) emailText += "\nEl Boricua Original";
if (box5.isChecked()) emailText += "\nEl Boricua de Pollo";
来自其他活动
if (box6.isChecked()) emailText += "\nBebida 1/2 litro";
if (box7.isChecked()) emailText += "\nBebida 1 1/2 litro";
我需要在不同活动中选择的一个选项将包含在一个邮件中
作为我需要的样本将是邮件
El boricua original
Bebida 1/2 litro
fanta
答案 0 :(得分:0)
如果您需要为结果启动活动,请执行以下操作:
Intent intent = new Intent(v.getContext(), whichDrink.class);
intent.putExtra("Bebida 1/2 litro","Bebida 1/2 litro");
intent.putExtra("Bebida 1 1/2 litro","Bebida 1 1/2 litro");
startActivityForResult (intent, 0);
然后在其中的饮料活动类:
String firstValue = getIntent().getStringExtra("Bebida 1/2 litro");
String secondValue = getIntent().getStringExtra("Bebida 1 1/2 litro");
至少你应该将这些关键字符串提取到常量
答案 1 :(得分:0)
试试这个
Intent intent = new Intent(v.getContext(), whichDrink.class.class);
intent.putExtra("DATA1","Bebida 1/2 litro");
intent.putExtra("DATA2","Bebida 1 1/2 litro");
startActivity(intent);
以whichDrink.class
方式接收数据
String DATA1 = getIntent().getStringExtra("DATA1");
String DATA2 = getIntent().getStringExtra("DATA2");