首页 > 解决方案 > 单击第一个和第二个活动的文本,应该对第三个活动可见

问题描述

我正在尝试找到最好的方式来显示我们在第三个活动中单击了第一个和第二个活动的 textview。

就像我有三个活动 AccountFrom、AccountTo 和 transferDetails。我想知道用户点击了什么帐户类型,以便我可以在第三个活动中显示。

标签: androidandroid-fragmentsandroid-activity

解决方案


1. on AccountFrom Activity
Intent intent = new Intent(AccountFrom.this, AccountTo.class);
**intent.putExtra("accounttype","accountTypeVariable");**
startActivity(intent);

2. Receive intent on AccountTo Activity
Intent intent = getIntent();
if (intent != null)
{
   String accountTypeValue = intent.getStringExtra("accounttype")
}

推荐阅读