Download Android install files *.apk from play.google.com

Hello fellows of my blog,

this time I wanna give you a brief description how you can download (free) Android programs (*.apk) files directly to your PC. From there you can install them on your device. You would need that in case your Android device has no internet connection, by what reason ever.

Continue reading

how to connect a python client to java server with TCP sockets

Hello folks,

this time I would like to share my knowledge about connecting a java server program with a python client program using TCP socket communication. Yesterday I spent quite a lot time to get this running, by reading several tutorials on socket programming but I only got java-java or python-python communication running smoothly.

Ok, my key problem was that java expects the end-of-line sign (EOL) in some way, that the python examples didn’t supply. It all depends on the combination of what kind of functions are used to read and write from and to the sockets. Continue reading

Updating Eclipse from Galileo to Indigo on Ubuntu 10.04 with Android SDK

Hello folks,
you probably know by now that I am working currently with Android using Ubuntu. On my laptop I still run Ubuntu 10.04 LTS 😀 and had problem setting up the new Eclipse version Indigo in combination with the current Android SDK r17.
Now I found a way that is pretty simple if you also wanna update your Eclipse version. Continue reading

run SL4A python script from within Android app

Hello folks,
in this post I wanna give you a short introduction how you can launch scripts (specifically python scripts) from your android application.

To follow this tutorial you have to have SL4A installed on your device / emulator.
In case you don’t know SL4A, you can check my previous post on that: https://norwied.wordpress.com/2012/03/28/scripting-on-android/ and I also found another quite good tutorial on how to install SL4A here: https://www.ibm.com/developerworks/opensource/library/mo-python-sl4a-1/index.html

Continue reading

call python script from Java app

Hello readers,

in this post I wanna give you a brief description how you can call python code from with a java program. For that purpose we will use two very simple “Hello World” programs, one in python, one for java.

First the python script. Create a new file “~/python/helloPython.py” with the following content:

import os
from stat import *

print "Hello World from python"

Now fire up your eclipse and create a default java application. Create a new java class named “PythonCaller”. The content of this new file will look like this:

package org.norbert;

import java.io.*;

public class PythonCaller {

/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
// set up the command and parameter
String pythonScriptPath = "/home/norbert/python/helloPython.py";
String[] cmd = new String[2];
cmd[0] = "python"; // check version of installed python: python -V
cmd[1] = pythonScriptPath;

// create runtime to execute external command
Runtime rt = Runtime.getRuntime();
Process pr = rt.exec(cmd);

// retrieve output from python script
BufferedReader bfr = new BufferedReader(new InputStreamReader(pr.getInputStream()));
String line = "";
while((line = bfr.readLine()) != null) {
// display each output line form python script
System.out.println(line);
}
}
}

So what is this doing? Basically we execute the python script by envoking python2.6 and provide the path to the script as parameter, as you would normally do it if you exec the script in a terminal/bash.
The output generated by the script is then read line by line with a BufferedReader and displayed in the terminal where we execute the java application.

You can execute the java program in eclipse by click on the green run button or compile and exec it in a terminal with:

cd workspace/JavaPythonCall/src/org/norbert
javac PythonCaller.java
cd ../..
java org.norbert.PythonCaller

result:

Hello World from python

Sweet ^_^ yeah 😉 This was a quick one, but I hope this helps.
cheers
norbert

Scripting on Android

Hello there,
so in this post I wanna tell you how you can use your favourite scripting language to write programs that run on your Android mobile phone. You know the typical way to program apps for android is writing them in java using the Android SDK. In combination with eclipse and the android development plug-in for eclipse that’s one of the easiest way to start your Android development.
But if you are not familiar with Java you probably have some difficulties to get along with learning Java first, before you can begin developing for Android.
In this post I show you a way you can use scripting languages and start directly with Android development

There is a framework you need to install on your phone called “SL4A” (Scripting Layer for Android)

Currently (MAR2012) the following Scripting Languages are supported:

  • BeanShell 2.0b4
  • JRuby
  • Lua 5.1.4
  • PHP 5.3.3
  • Perl 5.10.1
  • Python 2.6.2
  • Rhino 1.7R2

Continue reading

Android AVD Manager

Hello there,
in this post I briefly explain how you can create new virtual device for your Android emulator on your computer.
If you wanna develop applications for Android and don’t have an Android mobile phone at hand, you can start with the emulator coming along with the Android SDK. By the way, you get the Android SDK for free here: https://developer.android.com/sdk/index.html

Continue reading

Master Thesis – Near Field Communication

Hello everybody,

I know its quite a while since I posted anything here on my webblog, but now I am working on a new project that is really exciting. I am dealing with NFC (Near Field Communication) in the context of my Master Thesis here at TU Munich. The last months I did research on this topic and found that this technique is quite old BUT this year (2012) a great breakthrough is predicted.

In the upcoming blogpost I am going to keep you up to date of the progress of my thesis and the interesting stuff I stumble upon 🙂 So if I draw your interesst please check back on my blog for more interessting stuff 😉

cheers 😉