开发者

Android: how to use data passed from parent activity in a sub activity?

开发者 https://www.devze.com 2023-01-04 18:50 出处:网络
When we want to pass data from an activity to a sub activity we use the intent.pushextra() method and pass the request code and any additional data.

When we want to pass data from an activity to a sub activity we use the

intent.pushextra()

method and pass the request code and any additional data.

now in the subactivity ho开发者_StackOverflow中文版w can I get the additional data or the request code.

is there any event handler that handles this ?

thanks


You use intent.putExtra() to put data in the intent, then in the sub activity's onCreate() use getIntent().getExtras() or getIntent().getXXXExtra() methods.

For example for retrieving a String you would use: getStringExtra()

0

精彩评论

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