如何获得在Android的其他活动数据? [英] How to get data from other activity in android?

查看:159
本文介绍了如何获得在Android的其他活动数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个活动,如活动 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);

这篇关于如何获得在Android的其他活动数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆