Skip to main content

android - Tab activities getting destroyed when switching -


i have 3 tabs have created in fasion

intent = new intent(this, testlistactivity.class); view tabview = createtabview(mtabhost.getcontext(), tag); tabspec setcontent = mtabhost.newtabspec(tag).setindicator(tabview).setcontent(intent); mtabhost.addtab(setcontent); 

in 1 of them have images loading web. problem if switch tabs , come i'm loading images on again. before images stayed there once loaded every time switch tabs activity destroyed. idea might have changed cause this?

android - tab activities getting destroyed when switching - stack overflow

learn, share, build

each month, on 50 million developers come stack overflow learn, share knowledge, , build careers.

join world’s largest developer community.

sign up

i have 3 tabs have created in fasion

intent = new intent(this, testlistactivity.class); view tabview = createtabview(mtabhost.getcontext(), tag); tabspec setcontent = mtabhost.newtabspec(tag).setindicator(tabview).setcontent(intent); mtabhost.addtab(setcontent); 

in 1 of them have images loading web. problem if switch tabs , come i'm loading images on again. before images stayed there once loaded every time switch tabs activity destroyed. idea might have changed cause this?

share|improve question
    
have used setoffscreenpagelimit(int) anywhere? int param specified how many unfocused tabs loaded @ given time (that is, if it's set 0, reloading tabs). – eric jul 7 '12 @ 1:46
    
no haven't used method anywhere. object from? doesn't seem tabhost. – juno jul 7 '12 @ 1:51
    
oh, thought tabhost shared viewpager. if you're using same device when worked, check make sure setcontent not called if content initialized. otherwise, might consider switching viewpager (android 4.0 standard, , supported in v4 support library). – eric jul 7 '12 @ 2:27

your answer

 
discard

posting answer, agree privacy policy , terms of service.

browse other questions tagged or ask own question.


Comments