-5

I have two activities :Activity A and B.

I opened a webSockets in the Activity A,I will reveive the message at any time.However I want to show them in the Activity B(in the listView).But I donot konw how to pass the data which I just receive.Can any one help me?

JACK GAO
  • 1
  • 2

1 Answers1

0

I want to get the data in Activity B anytime.So what should I do?

Can you please tell,how you can get data in activity B anytime?

Here,you can store your data in constant or share preferences and get at activity B whenever you require.

OR

If you want to get data from service then you can use broadcast receiver so you can receive data at activity B.

Community
  • 1
  • 1
ViramP
  • 1,381
  • 9
  • 10
  • I opened a webSockets in Activity A, I will get the message at any time.and when I receive the message ,I want to show them in the LisiView (Whicn is at Activity B). – JACK GAO Aug 23 '16 at 14:13
  • @JACKGAO in that case you should be using a service with a broadcast receiver and Activity B should be listening for that specific broadcast from your service to update it – tyczj Aug 23 '16 at 14:15