android: send & get String besides by using extra() method

爷,独闯天下 提交于 2020-01-30 06:58:27

问题


I just wonder what method can be use to send String from one to another activity besides by using intent.putExtra(), and getIntent.getExtra(). Cause my project getting unexpected result when using putExtra(), just want to another for send String.

Any suggestion and examples? Thanks.


回答1:


you can also send by following ways

How do I pass data between Activities/Services within a single application?

Non-Persistent Objects

For sharing complex non-persistent user-defined objects for short duration, the following approaches are recommended:

  • Singleton class - Ref Here:

  • A public static field/method

  • A HashMap of WeakReferences to Objects



来源:https://stackoverflow.com/questions/16892411/android-send-get-string-besides-by-using-extra-method

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!