android - Timer not working intent error -


i'm making timer switches form 1 activity in 3 seconds. here code:

    new countdowntimer(3000, 1000) {          imageview img = (imageview)findviewbyid(r.id.single_image);         textview mtextfield = (textview)findviewbyid(r.id.textview1);                     public void ontick(long millisuntilfinished) {             mtextfield.settext("seconds remaining: " + millisuntilfinished / 1000);             img.setimageresource(resource);         }          public void onfinish() {         intent intent = intent(this, gameactivity.class);         intent.putextra("image", resource);         intent.putextra("difficulty", difficulty);         startactivity(intent);         finish();          }       }.start(); } 

it gets error @

initent intent = intent(this,gameactivity.class); 

its states following:

the method intent(new countdowntimer(){}, class<gameactivity>) undefined  type new countdowntimer(){} 

any idea why error?

in case, this refers countdowntimer class. need use activity context. change

intent intent = intent(this, gameactivity.class); 

to

intent intent = intent(activityname.this, gameactivity.class); 

Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -