I have a CustomReceiver that receives updates in the background. I am trying to make the app check if the main Activity is in front. If so, then a click on a button should be forced programmatically.
My app is about synchronized lists, so if someone updates a list and you're on it, I want to force a local refresh.
How to do that?
Note: If the user is working on the list, I do not want to do anything.
I tried something like the following:
try {
List_Items li = new List_Items();
li.refresh.performClick();
Log.d("never_got", "here");
} catch (Exception e) {
}
So if the Activity is not in the front it will catch the exception, but it wont push the button. Any ideas?