开发者

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

开发者 https://www.devze.com 2023-03-25 23:57 出处:网络
this is my class name public class Register extends TabGroupActivity I am calling 2nd activity through

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

精彩评论

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