3

When using a broadcast receiver to load an xml layout on screen (when an event happens). Sometimes the xml is not displayed, despite the fact the receiver catches the event.

Is there a check i can perform to see if a specific xml layout is displayed on screen atm?

Kara
  • 6,115
  • 16
  • 50
  • 57
Eitan Schwartz
  • 463
  • 6
  • 19

2 Answers2

1

To me your question reads like you want a getContentView() method, which Activity unfortunately doesn't have. Two alternative solutions to this problem can be found in these questions:

Why isnt there a getcontentview method for activity?

Is there any method getContentView like setContentview?

Community
  • 1
  • 1
Chilledrat
  • 2,593
  • 3
  • 28
  • 38
  • thx for answer, i dont have the reputation to vote this useful :/ – Eitan Schwartz Mar 21 '12 at 16:27
  • I didn't think you needed rep to **accept** an answer ? If you accept this one for now and somebody comes up with a better one you can always switch your choice at a later date. http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work – Chilledrat Mar 22 '12 at 13:50
  • I meant, this does not answer the question but is still useful. I thank you but i can't up-vote you. – Eitan Schwartz Mar 22 '12 at 14:00
  • Fair enough; my bad :-) Maybe adding a little more info / test code to your question will get you the answer you need. Good luck either way. – Chilledrat Mar 22 '12 at 14:08
0

If you are talking about making views visible. Follow these steps.

At first make desired view GONE in XML (Dont make them Invisible as they will block space). write following in View xml

android:visibility="gone"

When you will receive the broadcast make them visible using

viewName.setVisibility(View.VISIBLE);

Hope this help

Vipul
  • 27,808
  • 7
  • 60
  • 75
  • It's more a problem that the desired view is under current view (which is not wanted). In that case I want to detect that my view has gone under another and then bring it to front. – Eitan Schwartz Mar 21 '12 at 16:29