[Solved]-[libGDX] ((Game) Gdx.app.getApplicationListener()) error

Hey guys !!

i am following dermetfan tutorials in youtube so i saw this tutorial which is the fifth tutorial and i had this problem and don’t know what to do it just says that it’s an wrong syntax

package com.me.game.screen;

import aurelienribon.tweenengine.BaseTween;
import aurelienribon.tweenengine.Tween;
import aurelienribon.tweenengine.TweenCallback;
import aurelienribon.tweenengine.TweenManager;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.me.mygdxgame.Accessor;
import com.me.mygdxgame.MyGdxGame;

public class ScreenManager implements Screen {

	public Texture image;
	public Sprite splash;
	public SpriteBatch batch;
	public TweenManager tm;

	@Override
	public void render(float delta) {
		Gdx.gl.glClearColor(0, 0, 0, 1);
		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
		tm.update(delta);
		batch.begin();
		splash.draw(batch);
		batch.end();
	}

	@Override
	public void resize(int width, int height) {

	}

	@Override
	public void show() {
		tm = new TweenManager();
		Tween.registerAccessor(Sprite.class, new Accessor());
		batch = new SpriteBatch();
		image = new Texture("data/10.06.png");
		splash = new Sprite(image);
		splash.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
		Tween.set(splash, Accessor.Aplha).target(0).start(tm);
		Tween.to(splash, Accessor.Aplha, 2.5f).target(1).repeatYoyo(1, 2).setCallback(new TweenCallback(){
				

				
					
					public void onEvent(int type, BaseTween<?> source) {
						((Game) Gdx.app.getApplicationListener())

						
					}
}).start(tm);
	}

	@Override
	public void hide() {

	}

	@Override
	public void pause() {

	}

	@Override
	public void resume() {

	}

	@Override
	public void dispose() {
		Gdx.app.log("Dispose()", " Closing the app now");
		batch.dispose();
		splash.getTexture().dispose();

	}

}

A stacktrace would be nice, but currently the line


((Game) Gdx.app.getApplicationListener())

does currently nothing.

I know that but it just gives me error from here even if i made it to ((Game) Gdx.app.getApplicationListener()).setScreen(new var); it would also be an error.

This is a common problem I have when doing this and it is purely down to imports, just type the entire thing, hover over “Game” and import that, then import your screen. Problem solved.

Thank you for helping me the problem is solved :slight_smile: