小编Vig*_*esh的帖子

如何从android中的其他活动获取数据?

我有两个活动,比如ActivityA和B,我试图通过从A两个不同的字符串中使用到B BundlestartActivity(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);
Run Code Online (Sandbox Code Playgroud)

在B级我用两个TextViews分别显示A类的弦乐.

像那样:

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

filedetails = extras.getString("videodetails");
filename = extras.getString("videoname");
Run Code Online (Sandbox Code Playgroud)

问题是filedetils在B类中打印,但不是文件名.

对此有何解决方案?

android android-intent

7
推荐指数
2
解决办法
4万
查看次数

标签 统计

android ×1

android-intent ×1