Is it possible to write a regular old java program that runs on android?

I see tutorials showing how to make a real Android application with actions and all that, but all I really want to do is create a java class that has a static core void static (String params []) {System. out.println ("Hello World");} and run it using java HelloWorld on an Android machine. Is it possible?

+4
source share
2 answers

There is an excellent application on the Android market called the Terminal IDE , which includes an excellent shell environment, vim / nano and java / javac, all compiled to run on Android. With this, you can run "regular" Java code.

+8
source

In fact, if you take the time to create a very simple Activity (which Eclipse will generate for you when you create a new Android application, then you can create and call any class or method in this class that you therefore desire.

A method called create () will appear in the Activity class - you will modify it to create an instance of the class and call the desired method ...

protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Instantiate your class or simply call its main(String[] args) method here } 

Was it not so difficult there?

Good luck

Rodney

+2
source

Source: https://habr.com/ru/post/1390883/


All Articles