How do I get extra data from intent on Android?

后端 未结 16 2698
清歌不尽
清歌不尽 2020-11-21 11:01

How can I send data from one activity (intent) to another?

I use this code to send data:

Intent i=new Intent(context,SendMessage.class);
i.putExtra(\         


        
16条回答
  •  清歌不尽
    2020-11-21 12:02

    Just a suggestion:

    Instead of using "id" or "name" in your i.putExtra("id".....), I would suggest, when it makes sense, using the current standard fields that can be used with putExtra(), i.e. Intent.EXTRA_something.

    A full list can be found at Intent (Android Developers).

提交回复
热议问题