我尝试将数据从一项 Activity 传输到另一项 Activity ,但我无法实现。任何人都可以帮助我。请举例说明...提前致谢。
最佳答案
只能传递原始数据类型,如字符串、整数等。您也可以传递 ArrayList 等。无法传递对象。下面几行代码来解释一下:
从你要发送数据的activity
Intent intent = new Intent(this,NewActivity.class);
intent.putExtra("LABEL", <data>);
在新 Activity 中:
Bundle bundle = getIntent().getExtras();
data = bundle.getInt("LABEL");
关于android - 按钮单击事件中的数据从一个 Activity 传输到另一个 Activity ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4872856/