【发布时间】:2013-12-21 15:19:04
【问题描述】:
我正在尝试为超市的购物系统制作一个小项目。如何在另一个活动中显示我的结果?请注意,我的结果显示在同一活动中的 Toast 中。
这是我的代码:
public void showResult(View v) {
String result = "Selected Product are :";
int totalAmount = 0;
for (Product p : boxAdapter.getBox()) {
if (p.box) {
result += "\n" + p.name;
totalAmount += p.price;
}
}
Toast.makeText(this, result + "\n" + "Total Amount:=" + totalAmount,
Toast.LENGTH_LONG).show();
这里的 toast msg 显示了结果。
我想在 textView 中显示结果,例如在另一个活动中。
【问题讨论】: