java - Timer error in libGDX -


i have problem new task () in timer. compiler still find error @ new task ()

error:(52, 28) error: cannot find symbol class task

i not know why happening.

i programming in android studio.

this code:

import com.badlogic.gdx.applicationadapter; import com.badlogic.gdx.gdx; import com.badlogic.gdx.graphics.color; import com.badlogic.gdx.graphics.gl20; import com.badlogic.gdx.graphics.texture; import com.badlogic.gdx.graphics.g2d.bitmapfont; import com.badlogic.gdx.graphics.g2d.spritebatch; import com.badlogic.gdx.utils.timer;  public class flashgame extends applicationadapter {     spritebatch batch;     texture logo;     timer ti;     bitmapfont font;     int sch;     int scw;     string sc_he;     string sc_wi;     int imgh;     int imgw;      @override     public void create () {         batch = new spritebatch();         sch = gdx.graphics.getheight();         sc_he = sch+"";         scw = gdx.graphics.getwidth();         sc_wi = scw+"";         logo = new texture(gdx.files.internal("logo.png"));         imgsize(logo);         font = new bitmapfont();         font.setcolor(color.red);     }      @override     public void render () {         gdx.gl.glclearcolor(0, 0, 0, 0);         gdx.gl.glclear(gl20.gl_color_buffer_bit);          timer.schedule(new task() {             @override             public void run() {                 batch.begin();                 batch.setcolor(0, 0, 0, 1);                 batch.draw(logo, scw / 2 - imgw / 2, sch / 2 - imgh / 2);                 batch.end();             }         }, 1.0 / 60.0);     }      public void imgsize (texture id) {         imgh = id.getheight();         imgw = id.getwidth();     } } 

have error in aide, in line:

timer.schedule(new timer.task() { ... }, 1.0 / 60.0); 

1.0 / 60.0 return double, constructor wait float. works me:

timer.schedule(new timer.task() { ... }, 1.0f / 60.0f ); 

Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -