Let's say I have already done algorithms written in python, and now I want to use these algorithms in my android code. Can I use Java to get output from python? I need to send values from EditText as a parameter to python to be calculated in the algorithm and get a result. I can use Android Studio only with Java. Any suggestions?
Make a web API using python web framework like Django, Flask
Then send request to that API endpoint and calculate with your algorithm and return your result.
You can use Retrofit in Android studio to get the result.
Android studio doesn't have native support for python but you could try integrating a web API of python
Related
In my case I want to use Vosk in python for offline speech recognition and want to develope complete application on react native for handeling rest of the operation for controlling my phone. And this should be completely offline so don't want to setup saperate python server.
You can check their example of Android integration https://alphacephei.com/vosk/android and if you want to create a wrapper for React Native. Also, they have a wrapper for Native Script and you can check how they use it for android, for example here is a list of dependencies https://github.com/alphacep/nativescript-vosk/blob/master/src/platforms/android/include.gradle
UPDATE:
just found that react native vosk wrapper already exists: https://github.com/riderodd/react-native-vosk
I'm working on Flutter project in Android Studio platform and I faced a problem with how to write and run python API code inside my Flutter project without letting it as a backend code in another platform? since when I run my Flutter project that connected with python API code in another platform as a backend using post method, it's worked with the emulator but it does not work with my physical android device.
So is there any recommend solution for either the first problem or the second.
Thanks.
No it's not possible to write python code Inside Flutter code
But you can write your api in different framework like Django ,mongodb and use it in your Flutter app
I have done one small app using Django. Now, i'm trying to integrate docusign to my app.I have undergone through this url : https://github.com/peopledoc/django-docusign/tree/master/demo but it's not working .Any suggestions please?
Since Django is open source and it's based on python, you could build it yourself, add our Python SDK and make the API calls this way. Our Python SDK is also open sourced here - https://github.com/docusign/docusign-python-client
I am currently working on a capstone project. One of the things that I am trying to achieve is to be able to get a number sent from a python code and get it displayed on my app that I am building through android studio.
My general knowledge on how to tackle this would be to set my python as a client which sends the number and android studio as a server which displays the number however I am having trouble on how to proceed with this and would appreciate it if someone could help me out.
I believe the simplest solution would be for you to create a very basic Flask server (not client!) on a Python host, and have it handle a basic GET call, which will be invoked from the Android client, using an implementation of your choice, see this tutorial for example
This link says that Android support Python, Lua and BeanShell Scripts, subsequently for Perl too. If it is so, is it possible for developers to write python scripts and call them in their standard Java based android applications?
I remember reading about this awhile back as well.
It's not on the android dev site.
It's a separate project, android-scripting.
Python API:
API Reference
SL4A API Help
I think I have read somewhere that ASE with Python was a huge library ( several Mo), and so was completely unpractical for a public application.
But you can still use it for development...