android active间数据传递

Bundle是key-value存储。

Bundle bundle=new Bundle();
bundle.putString("key", "value");
Bundle bundle=new Bundle();
bundle.putString("key", "value");
Intent a= new Intent(this,TargetActivity.class);
a.putExtras(bundle);

如果不是在Activity类方法中,而是在其他类中,可以使用下面的方式声明Intent。

public class ActivityInstance extends Activity{

protected void onCreate(Bundle savedInstanceState) {}
private class RegisterOnclick implements View.OnClickListener {
public void onClick(View v) { 
 Intent a= new Intent(ActivityInstance.this,TargetActivity.class);   
}}
}

 这里涉及到如何获取Context.

posted on 2016-07-21 15:18  lucika.zh  阅读(516)  评论(0编辑  收藏  举报

导航