Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to transfer an existing Java program to Android? (what to import)

I have a fully-functional Java program that's fairly long, and I want to transfer it to an Android tablet. It's my first time doing anything for the Android. I know that it requires a different type of Java (or whatever the fancy lingo for that is), but I reeeeeaaallllly don't want to rewrite this WHOLE thing. Are there any easy swaps or equivalent thingies to import for my Android app? Here are the imports I have in the current program:

import java.awt.*;  
import java.util.*;  
import java.awt.event.*;  
import java.awt.geom.*;  
import java.awt.color.*;  
import java.awt.image.BufferedImage;  
import javax.swing.*;  
import java.io.*;  
import java.text.*;  
import javax.imageio.ImageIO;

Any other tips or links regarding the matter would be appreciated.

like image 663
Kalina Avatar asked Dec 21 '22 12:12

Kalina


1 Answers

You aren't going to able to port your application without some serious rewriting. From that list, Android does not have anything from:

  • java.awt.* (other than font)
  • java.awt.event
  • java.awt.geom
  • java.awt.color
  • java.awt.image.BufferedImage
  • javax.swing
  • javax.imageio.ImageIO

Any of your code that uses those will have to change dramatically.

The most significant issue is that Android has its own activity/view system instead of Swing/AWT, so you will have to redo your entire user interface from scratch.

like image 190
Christopher Souvey Avatar answered Jan 17 '23 07:01

Christopher Souvey