FileDocCategorySizeDatePackage
WithFramework.javaAPI DocAndroid 1.5 API1822Wed May 06 22:41:56 BST 2009com.android.internal.util

WithFramework

public class WithFramework extends Object
Binds native framework methods and then invokes a main class with the remaining arguments.

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)
Invokes main(String[]) method on class in args[0] with args[1..n].

        if (args.length == 0) {
            printUsage();
            return;
        }

        Class<?> mainClass = Class.forName(args[0]);

        System.loadLibrary("android_runtime");
        if (registerNatives() < 0) {
            throw new RuntimeException("Error registering natives.");
        }

        String[] newArgs = new String[args.length - 1];
        System.arraycopy(args, 1, newArgs, 0, newArgs.length);
        Method mainMethod = mainClass.getMethod("main", String[].class);
        mainMethod.invoke(null, new Object[] { newArgs });
    
private static voidprintUsage()

        System.err.println("Usage: dalvikvm " + WithFramework.class.getName()
                + " [main class] [args]");
    
static native intregisterNatives()
Registers native functions. See AndroidRuntime.cpp.