I have a problem with the new Task ()
in the timer. Compiler still find error at the new Task ()
Error:(52, 28) error: cannot find symbol class Task
I do not know why this is happening.
I programming in Android Studio.
This is my 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();
}
}