1

I have a problem where I have a program that takes an image file as input on a Java desktop program, processes it and now I need to send this image from the Java application to an Android handset.

In Java I have it stored as either a ImageIcon or BufferedImage and I need to turn it into an Android Drawable, preferably without sending the file back to disk.

I am using the latest in Java and Android 1.6

Currently using a RESTful webserver sitting between the Java Desktop application and the Android handset to assist communications.

1
  • Which version of android are you using? This may be beneficial to anyone capable of answering this question. Commented Mar 14, 2011 at 23:51

1 Answer 1

1

I think you'll have to create a web server to send the file to the device.

You don't need a full-fledge server. Listening localhost in some specific port that you may choose should be enough.

Then, you'd open the device and open your application (or simply the browser if you only want to dowload/view the image) and open the address of your server.

The simplest version would be creating a server in your computer (localhost), for instance using port 5555 and then go to the browser and open a page with the ip address/port of your computer.

Here is a tutorial on listening to a local port with java

Sign up to request clarification or add additional context in comments.

2 Comments

I have a RESTful webserver sitting between the Java Desktop application and the Android handset to assist communications.
So, do a request to your webserver (eg: /show_image). Then, in your webserver's controller invoke the java file. (some method to invoke scripts in the server like system.call("java /path/to/file.jar"))

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.