Java Application accessing Android App in Eclipse [closed] - java

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
In Eclipse, I have an android app and a Java Swing application that I run. If they are both running from Eclipse, can I get access to the other and read objects from it? This functionality is for development only and will not be used outside of eclipse.
I am aware of socketing in Java, but I would like to be able to read and modify variables on objects in runtime if possible.

Alternativelly, one could devise such a thing.
The Java app would need to be redesigned a bit, in a server-y way, to accept incoming pseudo-connections from a library.
The library which would expose the Android internals would have access to Android app via JNI. The said library would be compiled as a .SO file and included in the android app.
That being said, you would need to develop the said library to act as a bridge between your Java app, and your Android app.

if your only pourpouse is setting variable values on runtime just for development, the best option may be debug the app, and set breakpoints where you need to stop, set desired values and go on with the debug proccess

No, you cannot read objects from your Android App with your Java app.
Why? Android runs in emulator, which is a whole different process than the one running your Java code. Lately, OSes tend to not let any process touch other processess's memory because, well, malware.
The only way your Java app could touch Android app is if it were the parent of the Android app's process. Which is not going to happen. (unless you make it so)
So you need to redesign both of your apps with that feature in mind, and use the Java app as a backend that your android app will communicate to all the time, and think of your Java backend as "the server" - meaning, what the server tells you to do, you do it no questions asked.
No, you may not also 'poke' values at runtime without a attached debugger.

Related

How to use PHP/HTML as interface and Java/Python as function in background? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I'm thinking about writing a desktop application that the GUI is made with either HTML or PHP, but the functions are run by a separate Java or python code, is there any heads up that I can look into?
There are a couple of possible options:
Run your backend code as an embedded HTTP-server (like Jetty* for Java or Tornado* for Python). If the user starts the application, the backend runs the server and automatically starts the web browser with the URL of your server. This, however, may cause problems with the operating system firewall (running a server on the local machine)
You could also have a look at CEF (chromium embedded framework). It is made for exactly this purpose (running an HTML-Application inside your code). It uses the same codebase as the chromium (and chrome) web browser. It was developed originally for C++, but there is also a Java binding: java-cef
Oh and by the way, PHP is a server-side language. I would not recommend to use it in your scenario (since your backend code is Python or Java).
*I have not enough reputation to add more than two links, so you'll have to google those ones yourself.
You could expose data from Java or Python as JSON via GET request and use PHP to access it. There are multiple libraries for each of these languages both for writing and reading JSON. GET request can take parameters if needed.

Why Android support java but not other languages? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I see the statement below on Google in one form or another
Most of the Android development is Java based because Android supports
a large number of Java libraries
I am coming from Java based web application background. I have never heard the statement "Windows supports one specific language but Linux does not". Then why in context of mobile OS we say android supports Java. The role of any OS is to execute the commands and not to support the specific language, right?
I know I am missing something basic here, but what's that?
Then why in context of mobile OS we say android support java.
I do not know who "we" is. Experienced computer programmers would not say that, and even your made-up quote does not say that.
Role of any OS is to execute the commands not to support the specific language right ?
Correct. And, given a rooted Android device, you are welcome to try porting any language you like to Android, and in a custom ROM mod, you are welcome to arrange to allow the user to run any program they want in any of those supported languages.
However, most people do not have rooted Android devices.
On a normal Android device, the Android frameworks put some limitations on what you easily can use for programming.
For example, you can divide the world of Java-capable servers into two main categories:
Those where you have complete control over the server, which is roughly equivalent to running a rooted Android device
Those where all you can do is upload a WAR and related files (e.g., static assets), which are run on a Java-powered server managed by somebody else
In that latter scenario, you are not going to have complete flexibility in programming. Presumably, you could integrate JVM-based scripting languages, but you may have difficulty in using C++. That is not an issue with the OS — the server itself is probably perfectly capable of running a C++ program. It is an issue of the framework in which your code is running (whatever people use for WARs nowadays, as it has been a long time since I worked in server-side Java development).
The primary framework for Android development is based on Java. Courtesy of WebView, this also opens up hooks for hybrid development (HTML/CSS/JS). NativeActivity makes it possible to write full Android apps in C/C++. Various toolchains allow you to write in other languages (e.g., Kotlin) that compile into something that works with Android's frameworks, and you can embed scripting languages. But you still need to stick to the frameworks, which puts some limits on what you can do and how you can do it. This is not the fault of the Android OS, but rather the frameworks.
Yes, Android is based on Java. But recently the grandpa Delphi acquired fire monkey, which is supposed to transform Delphi code in to native Android code. That way it supposedly run just like a native application.

Is there a dlib library port for java? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I'm actually using OpenCV for face detection, but after watching this video : https://www.youtube.com/watch?v=LsK0hzcEyHI , I've noticed that dlib is much more accurate, and even in my tests, gives a lot of fale positives (but doesn't miss any face), does anyone know how to use dlib within a Java web application (not android) ? I've already found a port to Android, but I don't thinkk it's possible to use it with in a java web application.
Thank you
I have used dlib myself, and yes it is a very advanced and precise library. There is no port in Java as far as I know. But you can always have it compiled to a shared library (.so in linux or .dll in Windows), and then use that inside your Java code.
More on using a dll or using an so in java
There is also an option to use the C++ library directly within Java, using proxies. You might want to look into that.
Edit : As per #evgeniy's comment, most of dlib is header-only templates. You will not be able to use those if you export dlib directly as a shared library. What you might want to do instead is to expose whatever APIs you need, see here
Edit 2 : As #davis-king's pointed out, you may want to look into using swig and cmake as is done in the mitie/dlib Java api : See here.
If you are looking for Android: https://github.com/tzutalin/dlib-android
Otherwise, this https://github.com/bytedeco/javacpp-presets/issues/49 looks like the most promising but still opened at the moment.

Starting to make an application for Android [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
So I got this idea that I want to implement as an Android application. Now what I have learned so far is Java, C and C++. As I understand, Java would be the smartest choice right? Have to mention tough, my experience is of a 1st year CS student's.
So I basically want to make a application that you can launch from the phone and it will also have a little database and fetch info into it from the users Facebook account.
So my questions are these:
The facebook part seems to be the hardest one to me. How is this done? Are there any articles around where I could read about it.
Second is, should I develop the application in Java?
And third one is... If I do it in Java, I see that Google has a lot of stuff up for learning all of it. It also features two development kits. One is a stable version which works with eclipse and the other one is a preview thing which is a 0.xx version.
The second one seems to have all thoes fancy thing tough like having the phone preview on the screen all the time so that you can see how it looks like on the phone. And it seems to me that the Eclipse version does not have such features. So which one would be smarter to pick?
Today, most apps for android are written in Java and with Eclipse. I would recommend you to do the same, because it is the easiest way at the moment (IMHO).
The Android Studio is still in the alpha state (as you said), so it can have some bugs. That's why you should use Eclipse (Android Studio looks great though).
Two simple links to put you in the right direction ;)
https://developer.android.com/training/basics/firstapp/index.html?hl=cn
https://developers.facebook.com/docs/android/getting-started/
Edit for "how apps looks like in eclipse":
You have 3 options in eclipse to get a view of your app:
1. The xml-layout builder: in Android, you can create the layout of the app via xml or code. In Eclipse you have a preview of your applayout which you designed in xml (How it looks like)
2. Upload the app on your phone and watch it
3. Upload it on an android-emulator, so you don't have to use a phone
Follow this link for starting android apps development https://developer.android.com/training/basics/firstapp/index.html?hl=cn
Facebook is providing separate SDK for integrating with android apps & this link will help you https://developers.facebook.com/docs/android/scrumptious/

Making an executable with most Java code, but maybe another language added in [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I have been looking everywhere, and being a novice at Java and lacking proper terminology it seems impossible to find this.
I assume the correct term is "wrapping", but looking at other Java applications, such as: Minecraft, and seeing how pretty the launcher is and custom buttons, it seems impossible to accomplish such a feat with JFrame.
Do they code their own sort of frame? I've heard that you can "wrap" Java code in like C++ to make the launcher, and after passing the screen is launches the game (minecraft.jar).
Also, how is the exe file created? That once it is run it checks for a patch from the server, that installs the necessary files in a given directory and checks there for save files?
Is it another language? if so which? Which do You recommend? A resource for learning all of this?
These are the main aspects that I've been struggling to learn as no one seems to ask a similar question as I.
Also, considering Java is cross-platform, my main targets are Windows > Mac, for now I can't be bothered to worry about Linux considering I'm already struggling so much here; so for now, how to create a Exe file, if need be, in C++ or any other language, then perhaps DMG for Mac.
You have a lot of things to consider. I would suggest that for now you use Java WebStart to launch your application. This gives you things like:
Easy distribution - put files on a web server somewhere and a JNLP file describing how to glue your files together.
No messing with EXE-wrappers and multiple distributions - this is in the standard Java installation.
Easy updates - just create a new set of files (don't update jars in place) and a new JNLP and thats it.
A sandbox without any effort. Full access to the machine needs code signing which these days is a moving target. Sandbox should be enough for quite a bit though.
Then when you find you have enough users to warrant platform-specific distributions, you can add these as needed instead of getting everything working up front, where you should be concentrating on your application instead.
If you do not want to go the JNLP route, there a number of tools which can do what you ask for.. my favorite is launch4j, which is easy to use via the launch4j-maven-plugin, see e.g. this launch4j-demo illustrating how to use it.
PS: Alternatives include http://sourceforge.net/projects/jsmooth/ or http://www.ej-technologies.com/products/exe4j/overview.html (.com). Note that similar Qs to this with more have been asked on How can I convert my Java program to an .exe file?, How Can I convert Java To Exe, Best free tool to build an exe from Java code?

Categories

Resources