What is the Android equivalent of JFrame?

android, android-studio, java

Solution

In Android what you would usually do is subclass Activity if you want to make a "screen" and View if you would like to make a UI widget.

But before you subclass any of them you should know that while they have some similarities to JFrame, they are VERY different and there are a lot of Android specific stuff you need to know about before you start using them. I would start by taking a look at managing activity lifecycle.

For an example of a way to make simple 2D game in Android, take a look at this.

Problem

I just wrote a Java program for a game and I was wondering how I could get the same game to run on Android using Android Studio. I noticed that Android does not support JFrame, though. What is the Android equivalent to JFrame?

Original source