I am running an android application that simply pops out a window saying “hello.” When I run it in the emulator, it says “Unfortunately, HelloAndroid has stopped.” Is there an error in my code?
package com.example.helloandroid;
import java.awt.Color;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class HelloAndroid {
public static void main(String[] args) {
JFrame window = new JFrame();
window.setVisible(true);
window.setSize(200, 300);
JLabel text = new JLabel();
text.setText("Hello");
text.setForeground(Color.RED);
window.add(text);
}
}
Android does not support the Swing/(IIRC) awt, or the full desktop Java API. Sorry.