我对 Android 编程的理解有问题。
当我想在我的应用程序上添加选项卡时,我使用我的选项卡和与这些选项卡相关的 Intent 创建代码。
现在,我将获取由我的选项卡创建的 Activity 的实例。 (检索公共(public)选项卡的字段,例如 2 并与 3 的公共(public)字段连接。所有这些都在我启动了 TabHost View 的 Activity 中)
如何在不使用静态的情况下执行此操作?
预先感谢您, 朱利安。
最佳答案
您是否为每个选项卡使用不同的 Activity ?
如果是,则将该字段视为字符串,在示例 2 中:
Intent intent = new Intent(this, YourThirdActivity.class);
intent.putExtra("Field2", field2.toString());
在示例 3 中:
intent = getIntent();
Field2 = intent.getStringExtra("Field2");
关于java - Android Intent 和这个新 Intent 的对象(实例),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10584542/