Java appium detect controller name

i want to what is the current screen class name. and moreover i also want to detect if the screen is navigated to next screen what is the next screen name