0

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?

Shade
  • 9,936
  • 5
  • 60
  • 85
Jesus Dimrix
  • 4,378
  • 4
  • 28
  • 62
  • What do you mean by if user is working on the list i do not (!) want to do anything? – Hoan Nguyen Mar 24 '13 at 17:36
  • i mean that the user can get updates when he not using my app . so i dont want the activty to come to front . but if the activty is on so press the button for him – Jesus Dimrix Mar 24 '13 at 22:16

0 Answers0