java - android - Run code before layout is shown -


one of items on app option leads activity. ok, can send option other activity, must read option , hide stuff layout based on info.

i have added oncreate method, no succes:

bundle extras = getintent().getextras(); string type = extras.getstring("objects");  if(type == "animals"){            imageview fieldswamp = (imageview) findviewbyid(r.id.btnswamp);     ((linearlayout)fieldswamp.getparent()).removeview(fieldswamp);      imageview fieldgrass = (imageview) findviewbyid(r.id.btngrass);     ((linearlayout)fieldgrass.getparent()).removeview(fieldgrass);            } 

then tried on "onlocationchanged" method no success either. i'm not sure if problem in code or if put it. can please help?

thanks in advance!

try this, because .equalsignorecase better comparing strings, , it'll ignore letters case.

if("animals".equalsignorecase(type)){            imageview fieldswamp = (imageview) findviewbyid(r.id.btnswamp);     ((linearlayout)fieldswamp.getparent()).removeview(fieldswamp);      imageview fieldgrass = (imageview) findviewbyid(r.id.btngrass);     ((linearlayout)fieldgrass.getparent()).removeview(fieldgrass);            } else { log.e("type","didn't remove views."); } 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

IIS->Tomcat Redirect: multiple worker with default -