android - issue using setContentView() after making WindowManager -


we start activity starts service becomes idle until service calls activity again. activity goes onpause(i believe) , isn't started until broadcastreceiver gets call start. service creates windowmanager system overlay , when user triggers it, supposed call activity , make activity make new view stuff in it. goes through without hitch, no errors popup , logs suggest code runs through smoothly, new view supposed made never comes view. interestingly enough though, if click app start again, pops view wanted earlier. i'm curious why doesn't happen when want to, instead remains invisible. i've tried setting view visible, tried bringtofront(), , tried flags on intent bring activity top of stack none of work. relevant code below.

im not here hear why don't think app user or don't think follows androids base "design" want debugging interesting bug.

mainactivity

@override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         intent intent = new intent(mainactivity.this, myservice.class);         startservice(intent); //if comment out these lines , add call         initservice(); //to figureoutparam below works         senduserhome(); //this 1         figureoutparam("update",0); //this call use through                          //the method though right neither param important     }       public void figureoutparam(string param, int top){          if(param.equals("update")){              view myview = new view(this);              layoutinflater inflater = (layoutinflater) getsystemservice(layout_inflater_service);             myview = inflater.inflate(r.layout.activity_main, null);             myview.setbackgroundcolor(color.blue);             myview.bringtofront();              setcontentview(myview);         }     } 

myservice (only important part involving call service)

 @override     public void oncreate() {         super.oncreate();          windowmanager window = (windowmanager)getsystemservice(context.window_service);         display d = window.getdefaultdisplay();         int width=d.getwidth();         int height=d.getheight();         height= (int)(height*.025);           params = new windowmanager.layoutparams(windowmanager.layoutparams.fill_parent,height,                 windowmanager.layoutparams.type_phone,                 windowmanager.layoutparams.flag_not_touch_modal|                 windowmanager.layoutparams.flag_watch_outside_touch |                  windowmanager.layoutparams.flag_not_focusable,                  pixelformat.translucent);         params.gravity=gravity.bottom;     wm = (windowmanager) getsystemservice(window_service);      }      public void updateview(string params){             intent = new intent(my_intent);             i.putextra("y", this.y);             i.putextra("param", params);             sendbroadcast(i);         } 

manifest because, because

try inserting figureoutparam("update",0); after super.oncreate(savedinstancestate);.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -