我有类似的设置,游戏,家里的许多活动etc.i要接受来自用户设置的一些值page.when我点击完成按钮所有这些值都到B存储在variables.at同时我我要回家乡page.from有我要游戏class.in,我想要得到的$ P $从设置pviously存储的值page.i知道使用束更好地做到这一点task.but我天玑knw如何使用下面me.given超过1 value.plz帮助我的code段
done.setOnClickListener(新OnClickListener(){
@覆盖
公共无效的onClick(视图v){
// TODO自动生成方法存根
namevalue = name.getText()的toString()。
。高估= over.getText()的toString();
。audiostatus = audio.getText()的toString();
意向意图=新的意图(Settings.this,home.class);
束束=新包();
bundle.putString(namevalue,namevalue);
intent.putExtras(包);
startActivity(意向);
}
});
解决方案
您应该使用意图
本身传递从一活动到另一个。
使用
intent.putExtra(名,数据);
你可以参考这个 线程
i am having many activities like settings,game,home etc.i want to accept some values from user in settings page.when i click on the done button all these values have to b stored in variables.at the same time i am going back to home page.from there i am going to game class.in that i want to get the previously stored values from settings page.i know using bundle is better to do this task.but i dnt knw how to use that for more than 1 value.plz help me.given below is my code snippet
done.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
namevalue=name.getText().toString();
overvalue=over.getText().toString();
audiostatus=audio.getText().toString();
Intent intent=new Intent(Settings.this,home.class);
Bundle bundle = new Bundle();
bundle.putString( "namevalue",namevalue);
intent.putExtras(bundle);
startActivity(intent);
}
});
解决方案
You should use Intent
itself to pass data from One Activity
to another.
Use intent.putExtra("NAME", data);
you could refer to this thread
上一篇:Symfony2 和 Twig - 检查资产是否存在是否存在、资产、Twig
下一篇:如何使用自定义 Twig 扩展在 Symfony 中使用 Session自定义、如何使用、Twig、Symfony