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

后端 未结 1 1142
自闭症患者
自闭症患者 2021-01-24 04:03

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

1条回答
  •  悲哀的现实
    2021-01-24 04:32

    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 讨论(0)
提交回复
热议问题