Convert android project to java project - java

I've just finished developing an application for android. I want to have a desktop version that is based on java, too.
I have to convert all layouts to swing and what other conflicts I may face, god knows.
Is there a tool for converting android apps to jar standalone? What is the easiest way to do this?

There is no tool to do this, as Android and Normal Java apps are very different.
The best you could do is move the non platform specific code into a library project, and reference it from both the Java and Android applications. So all code that doesn't use any import with android in it should be movable into the library, while all your swing/android specific code will go into the referencing projects.

Related

Combining android and gwt?

I'd like to develop a hybrid app using mgwt-phonegap.
I found this link :
What I don't get is: Why is he putting the gwt-code into the android project's folder? Isn't it unecessary to use Android at all when you use mgwt and phonegap? I thought, that was the whole idea behind it?
What do you get from creating an android project and then putting your gwt code inside it?
Can you use gwt to convert a standard android app into a hybrid app for different platforms?
I did not read the tutorial you mention, but with phonegap you can create a native shell, which is basically a WebView with some hooks to call native stuff, In this shell you place your HTML/Javascript which in your case is the compiled code of a mgwt project. The android project you create it with phonegap, their site has a tutorial, I think you should read more about phonegap.

Can you use java.swing and javafx for android development?

I dont really know a lot about about android development and i was wondering if it's possible to use java.swing and/or javafx for it.
You can use JavaFXPorts to develop JavaFX applications (not Swing applications) that are deployable on Android. Refer to the JavaFXPorts documentation for more information.
You will need to make your own assessment of whether using JavaFXPorts is an appropriate approach for your application or if you are better off coding purely to the native Android SDK provided by Google or using another 3rd party development SDK such as Unity. I will make no such recommendation here.
No it's not possible. Androids java (Go) does not include the java.swing and the javafx packages.
Android does include it's own gui packages more specialised for it, so I don't see why you would even want swing or javafx.
No you can't use Swing or JavaFX because Android has another type of architecture to render the views. Visit this official website to learn more about views in Android
http://developer.android.com/intl/es/guide/topics/ui/overview.html
Hope it's helps.

I have to create google maps for android but the code I presently have is in java script developed in .net

My maps project is basically developed by using java script in .net,
All the files are in .cs format. I want to convert this entire project into android project
or if there is any source code present please provide me.
I am presently using android development tool plugin for android development.
The default sample maps is not working in my eclipse.
Suggest me any other options?
How to resolve this issue?
If you are comfortable with using c# already and really only need the maps. You should look into Xamarin

Creating an android app from an Eclipse Java project

I know that questions like this have been asked before, and I have been sifting through them. So here is my situation: I have a decent amount of experience using Java, specifically Eclipse, and I have a game ready that from my current standards, could be uploaded to the Google marketplace.
However, I have the project saved as a Java project. How do I make this project into an android app? I have attempted using the ADT plugin for Ecclipse, and changing the nature of the project file but I am beyond confused regarding how to proceed.
Right now I can click: Run < Run as < Java application.
The goal is to be able to click: Run < Run as < Android application.
I don't know of a streamlined way of doing it. Is your game using Swing as a UI? JavaFX? Is it text?
Regardless, I imagine your game would need to be wrapped in an android activity in some way. e.g. The activity can invoke the browser to run your applet (if your game is an applet).
I'd first create an android project, then copy your source from the java project into the android project. The manifest (R) will be updated with the new resources, etc.
Then you have to finish wiring everything up.
It's going to take more than that. Android has it's own UI system and lifecycle that differs from raw Java. Depending on how you've written the game you may be able to reuse a lot of the drawing and logic code but you going to need to make a lot of changes to the input and allowing multiple screen sizes.
Without seeing your code I can say exactly what you'll need to do but I can tell you it's not going to be as simple as Run As... Android Application.
Although android apps are written in Java code, this doesn't means that it is possible to "translate" a java program or a game in an android app simply clicking a button.
If the game are complex I suggest that you rewrite the game using a framework for develop android game!! You can reuse some logic but sure you have to create all the graphics and readapt the game to run in android devices.
GOOD WORK!!
Be patient and star from here:
Androi Developers
It is not possible. You can implement the application logic in Android in the same way that you used in Java, but you cannot simply convert the java project into Android project. Some packages used in your java project (like swing) can't be used in Android.

Build Android native library with Adobe Air

I'm currently working on an Android application built with Adobe Air sdk, in AS3. I was wondering if it's possible to compile a kind of UI library that I can import in a Android native application (Java). Basically, I would like to build my UI with Adobe Air, but the main part of my application with Java, the native way.
What I have in mind is to convert the adobe air-generated APK into a Jar file I would import in the native application project, and call some functions that display something on the Screen.
Is it possible? I think it may be possible, because when I don't import Adobe Air SDK in the application, I must install Adobe Air application with the Play Store to make my application working. I don't find lot of things on Google about that :s.
Thank you for your help.
Yes it can be done (in theory), but hold on to your hat, it's a bumpy ride!
I see it is a very old question, with a new bounty (the questioner has not logged on for 3 years!), but here we go...
This method goes to the heart of how android java apps are constructed and run (i.e. DEX, so it will work with adobe-air or ANYTHING, it is fundamental [general method]). (by the way you use the word native in a confusing way, native is commonly understood to mean the JNI (c++) library element of an app).
You say:
"What I have in mind is to convert the adobe air-generated APK into a
Jar file I would import in the native application project, and call
some functions that display something on the Screen."
Android programs are compiled into .dex (Dalvik Executable)[now called ART but binary compatible] files,
which are in turn zipped into a single .apk file on the device (with other things like the manifest and resources). (unzip a .apk and look inside).
A .jar file contains DEX files (zipped). (unzip a compiled .jar and look inside).
I have done some work like this before, here's a link to a tutorial and coding examples [tested by me] (in android studio + gradle) [custom build elements are usually needed (I also give an ant example)].
See my stack-overflow answer Dynamic loading of DEX files
This in theory answers your question, but it's fundamental stuff, complex and has limitations that make it hard to code and maintain (resources are a real pain in the a**e).
Question: This all seems very complicated and hard !
Yes it is ! It is an increadably silly an difficult thing to do! That is why we invented cross platform frameworks, (and for web based code javascript/css/html5...). Failing that PORT the code.
I'm more of a Flash/AS3 coder than Java so can't give you a full answer but...
A better approach might be to just render your SWF-based User Interface itself via Java code (as opposed to compiling SWF into APK format then trying to embed Flash APK inside Android APK).
This way your SWF can also communicate with Java functions (via AS3's external Interface class). Making it easier to trigger Java functions when a button on the SWF U.I is pressed etc..
You just have to find an SWF render library for Java.
Maybe check out SWFTools. Particularly the SWF Class looks promising. I have not tested this library but it might help you.
I am not a Adobe AIR developer at all, however, I have developed a few Android App with both native environment and with some kind of framework (specifically PhoneGap). So, may this can help you.
I don't think that there would be any tool which could directly convert mobile apps build using frameworks like Adobe AIR, PhoneGap or any other HTML5 based framework to a native Android app because technically it is very difficult and unfeasible to do a proper mapping between each and every element of HTML5 (or Flex element in your case) to a corresponding native control or logic. The best you can do is use plugin mechanism provided by your framework to interact with Java and vice-versa and basically that is why the framework is there. For most of HTML5 based frameworks there is a plugin mechanism which allows developer to interact with native functionality (like Background Services, Activity or any other native resource). Even these frameworks are build using the same modular or plugin based approach and there major functionality (accessing Camera, Audio, SD Card etc native resources) works like this. We have to enable that feature before using that in our app.
So, look for plugin type of mechanism in Adobe AIR.
Hope this helps.
Maybe this is a dirty way to help you, but you can :
Install the adobe air program in one computer
Copy the files of the install folder of the adobe air program
Embed all this files in the java application
Install the java application
Save the adobe air files in one folder
Start the adobe air with java (like you will do it with the console, a simple call to YourAirApp.exe)

Categories

Resources