android - App returns to home screen, when add is displayed using TimerTask() -


it's first app create , new android ,

i designing app displays advertisement screen, every 1 minutes when user opens app ,

the advertisement screen works expected ,but problem when advertisement screen exit , app gets returned home screen no matter user in activity screen

the app flow

splashscreen.java --> adsplash --> diamondworldmenus ( home screen )

diamondworldmenus .java

public class diamondworldmenus extends tabactivity implements onclicklistener {   on create(.......){      public void startadsplashforevery1minutes(){             //starting adsplashtimer.java every 5 minutes             timer mytimer = new timer();              mytimer.schedule(new timertask() {                        @override                 public void run() {                     runonuithread(new runnable() {                          @override                         public void run() {                             // todo auto-generated method stub                             intent viewtargetactivity = new intent(getbasecontext(), adsplash.class);                             startactivity(viewtargetactivity);                         }                     });                 }             },60000, 60000);         }   }  } 

adsplash.java

public class adsplash extends activity  {     protected boolean _active = true;     protected int _splashtime = 8000;     webview ad;     websettings web_settings;     webviewclient yourwebclient;      @override     public void oncreate(bundle savedinstancestate)      {           requestwindowfeature(window.feature_no_title);         getwindow().setflags(windowmanager.layoutparams.flag_fullscreen,windowmanager.layoutparams.flag_fullscreen);         super.oncreate(savedinstancestate);         setcontentview(r.layout.ad_splash);         string url = "http://some_add_link.aspx";         yourwebclient = new webviewclient();         ad=(webview)findviewbyid(r.id.ad_web);         ad.getsettings().setjavascriptenabled(true);           ad.getsettings().setsupportzoom(true);                ad.getsettings().setbuiltinzoomcontrols(true);          ad.setwebviewclient(yourwebclient);         ad.loadurl(url);                      thread splashtread = new thread()          {             @override             public void run()              {                 try                  {                     int waited = 0;                     while(_active && (waited < _splashtime))                      {                         sleep(100);                         if(_active)                              waited += 100;                     }                 }                 catch(interruptedexception e)                  {}                                  {                     finish();                     intent in1 = new intent(adsplash.this,diamondworldmenus.class);                     startactivity(in1);                 }             }         };         splashtread.start();     } } 


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -