I am developing application that is using GCMIntentService for Push Notifications. So I want to refresh the Data of one ListView that is in a tab of my TabActivity. So is it possible to do that from the GCMIntentService when i receive and GCMIntentMessage?
For example
SecondTabActivity.callOnResume(); //or something like this
or
SecondTabActivity.callOnCreate(); // or something like this
I need to do this without using startActivity(intent); cause If I do the SecondTabActivity is getting out of my TabHost and it’s starting like new Activity. The function for refreshing the ListView is located at onCreate() and onResume() in the SecondTabActivity so that is why I want to call them. If there is any other way beside this one please refer to it. Thanks
A good way is to use broadcast intents.
In your TabActivity’s onCreate, use the Context.registerReceiver method to register a broadcast receiver for an intent named something like “MyGCMMessageReceived.”
In that broadcast receiver, call the method that refreshes your list.
Make your GCMIntentService’s onMessage method broadcast an intent named “MyGCMMessageReceived”.