Jframe equivalent android

I have created two window frame in JAVA using awt and swing package. My Java code is like:
import java.awt.*;
import javax.swing.*;
public class TopLevelWindow {
private static void createWindow() {
JFrame frame = new JFrame(“Simple GUI”);
//frame.setDefaultCloseOperation(JFrame.EXIT_ON_ CLOSE);
JLabel textLabel = new JLabel(“Hi Ans “,SwingConstants.CENTER);
textLabel.setPreferredSize(new Dimension(300, 100));
frame.getContentPane().add(textLabel, BorderLayout.CENTER);
//Display the window.
frame.setLocationRelativeTo(null);
frame.pack();
frame.setVisible(true);
}
public static void main(String[] args) {
createWindow();
createWindow();
}
}
Now on executing my code I am getting two window like frame and switching between these two frames.
The same thing I want it to do in Android means
How to create a window like frame in Android.
At a time two frames are there and we easily switch between frame.
Leave a Reply