如何获得在Android的其他活动数据?如何获得、数据、Android

2023-09-04 05:37:34 作者:°擁抱、最疏離的姿勢_

我有两个活动,如活动 A和B,我试图通过两个不同的字符串从A使用捆绑和 startActivity(意向)

I have two activities such as Activity A and B and I'm trying to pass two different strings from A to B using Bundle and startActivity(intent).

像这样:

Intent intent = new Intent(A.this, B.class);
Bundle bundle = new Bundle();
bundle.putString("vidoedetails", filedetails);
//bundle.putString("videoname", filename);


intent.putExtras(bundle);
//intent.putExtra("videofilename", filename);
//intent.putExtra("vidoefiledetails", filedetails);
startActivity(intent);

和B级的我用两个的TextView 按s显示从A类分开。

And in class B I'm using two TextViews to display the strings from class A seperately.

像这样:

Intent i = getIntent();
Bundle extras = i.getExtras();

filedetails = extras.getString("videodetails");
filename = extras.getString("videoname");

现在的问题是 filedetils 获得印刷类B中,但不是文件名。

The problem is filedetils get printed in class B but not the file name.

这个解决的办法?

推荐答案

你有一个错字:

bundle.putString("vidoedetails", filedetails);

bundle.putString("videodetails", filedetails);