开发者

how to transfer data from one child activity to another using startChildActivity?

this is my class name

public class Register extends TabGroupActivity

I am calling 2nd activity through

startChil开发者_开发知识库dActivity("Register", new Intent(Register.this,RegisterForm.class));

can any one help me how to transfer some data through this method


Intent i = new Intent(Register.this,RegisterForm.class);
i.putExtra("name", yourdata);//i assume you are adding some string data
startChildActivity("Register", i);

//in RegisterForm.class

Intent i = RegisterForm.this.getIntent();
i.getStringExtra("name", "default Value you want");


You have to implement an interface called Parecelable and write your object inside a Parcel so that you can transport it through the Intent

This tutorial will teach you how to do that

http://www.codexperience.co.za/post/passing-an-object-between-activities-using-an-intent

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜