How to pass values from a Class to Activity - Android

前端 未结 6 1264
误落风尘
误落风尘 2021-02-09 08:23

I have a newbie question about Class/Task/Activity. I\'m coming from C so I don\'t know if it\'s a good approach to do what I need.

I\'ve created a class:



        
6条回答
  •  悲&欢浪女
    2021-02-09 08:57

    there are many ways you can achieve this following are some

    1. you can use interfaces as explained in one of the answers
    2. you can create a IntentServce instead of your class and use Result Receiver to communicate the data.
    3. you can use handlers and messages as well
    4. you can also create a service and use IBinders (Bound Service)

    you can Google out more about these methods and chose what suits you better

提交回复
热议问题