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

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -