使用android intents如何在父亲和intent h之间传递参数 [英] working with android intents how to pass arguments between father and the intent h in

查看:99
本文介绍了使用android intents如何在父亲和intent h之间传递参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我要从当前活动中打开另一个活动,并且想传递诸如我的案例难度级别之类的参数,怎么做?

Assuming i want to open another activity from my current activity and i want to pass arguments such as in my case difficulty level how do I do it?

newGameButton.setOnClickListener(new OnClickListener() {
        public  void onClick(View view) {

            Intent i = new Intent(countryCityGameMenu.this,GameScreen.class);    
            startActivityForResult(i, GlobalDataStore.STATIC_INTEGER_VALUE);

        }
    });

是否可以在调用中传递这些参数?

is there a way to pass those arguments in the calling ?

有人可以举例说明

发送活动应该做什么 新生的活动应该做什么

what send activity should do what the new born activity should do

推荐答案

您必须使用以下附加功能:

You have to use extras like this:

i.putExtra(varName,value);

i.putExtra(varName, value);

这篇关于使用android intents如何在父亲和intent h之间传递参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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