Creating cross platform games

I am a game programming newbie and right now I am just trying to make some simple games in Java, following through various tutorials, etc. However, I have an interest in making both desktop and Android games. I have seen frameworks such as libGDX that allow for cross platform support but I was wondering how I would go about developing a cross platform game myself. I was wondering if anyone knows of any examples of people doing this that I could look at.

LibGDX will do most of the work for you, by giving you the tools to make a game for different platforms, but it is up to the programmer to implement the different input handling methods and configurations of the game, depending on the platform. Your actual game code, will remain relatively untouched. Of course you have to keep in mind the different specifications of mobile devices, backwards-forwards compatability with the device you are developing for (if that’s a problem/becomes one), etc. But for the most part, LibGDX will take care of the core porting.

Thanks, I looked at libGDX, went over a few tutorials, and plan to investigate it further, but I first want to look at making some games without a game engine, and dealing with some of the nitty gritty details myself. But I was also hoping it might not be too difficult to structure my code in such a way to handle a little bit of cross platform development myself.

Note that libGDX is not a game engine, you still have to do that yourself.
Also, how to write cross-platform games in java? Write them in java.

Sarcasm aside, porting between desktop and android is not worth doing manually, not when libGDX does it for you; I’ve actually not aware on how to do it, although I imagine it involves the Android SDK.

A motto of people here on this forum goes along the lines of “Stop making frameworks and make your game.” I would follow that advise if you do indeed want to make a game.