Reputation: 69
So I need to update two views if the user is currently on those views when a notification that stores data is received. I update the views onResume and such but if the user is on one of the pages and gets data it will not update and I do not know how I can update the view as it would require context and I cannot figure out how to transfer context or even update the Linear layout without calling in these functions in the class that contains the layout and view. Any help to accomplish this is greatly appreciated. EDIT: The calss that I am using is not ordinary it is the GCMIntentClass that receives messages. That's why i need to handle the data and when it gets this data update the layout of the activity that the user is in.
Upvotes: 0
Views: 90
Reputation:
You can pass the Context
via the constructor of the class that is not an Activity. For example:
public MyClass(Context c) {
this.context = c;
}
And then use the Context
to do whatever you want with the View
Upvotes: 1