Which programming languages can I use on Android Dalvik?

At launch, Java was the only officially supported programming language for building distributable third-party Android software. Android Native Development Kit (Android NDK) which will allow developers to build Android software components with C and C++. In addition to delivering support for native code, Google is also extending Android to support popular dynamic scripting languages. Earlier … Read more

How to load a Java class dynamically on android/dalvik?

There’s an example of DexClassLoader in the Dalvik test suite. It accesses the classloader reflectively, but if you’re building against the Android SDK you can just do this: String jarFile = “path/to/jarfile.jar”; DexClassLoader classLoader = new DexClassLoader( jarFile, “/tmp”, null, getClass().getClassLoader()); Class<?> myClass = classLoader.loadClass(“MyClass”); For this to work, the jar file should contain an … Read more

Using static variables in Android

static fields are attached to the Class instance as a whole, which is in turn attached to the ClassLoader which loaded the class. the_instance would be unloaded when the entire ClassLoader is reclaimed. I am 90% sure this happens when Android destroys the app (not when it goes into the background, or pauses, but is … Read more

Is it possible to dynamically load a library at runtime from an Android application?

Sorry, I’m late and the question has already an accepted answer, but yes, you can download and execute external libraries. Here is the way I did: I was wondering whether this was feasible so I wrote the following class: package org.shlublu.android.sandbox; import android.util.Log; public class MyClass { public MyClass() { Log.d(MyClass.class.getName(), “MyClass: constructor called.”); } … Read more