Android:Passing a hash map between Activities

后端 未结 5 1022
我在风中等你
我在风中等你 2020-11-27 03:59

I have a map between string and a class object. I populate this map in Activity1 and i would like to pass it to activity2.

public class NEW extends Activity         


        
5条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-27 04:59

    You can encapsulate your data in a Bound Service as described in this document:

    http://developer.android.com/guide/topics/fundamentals/bound-services.html

    Don't forget to add your server to the manifest file.

    this solution has the advantage of decoupling your data from your UI, which will ultimately lead to a more maintainable design.

    If the need arrises you can add a messaging wrapper to your service's API to allow it to be called from other processes / applications

提交回复
热议问题