android: send & get String besides by using extra(

2020-04-16 03:20发布

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条回答
该账号已被封号
2楼-- · 2020-04-16 03:24

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

查看更多
登录 后发表回答