I have a simple android apk which has one activity and other classes with simple UI(two button, one text layout), I generated that as a apk and now I want to load that using dex class loader in a new android app and starts the activity of the apk from the new app.
I wrote a simple class loader but I dont know how to starts a activity of that apk, below is code written for loading the class,
please let me know 1. how to starts the activity of the apk? 2. how to load all the class of apk ?
final String apkFile =Environment.getExternalStorageDirectory().getAbsolutePath()+"/Download/Offloadme.apk";
String activtyName= "com.example.test.MainActivity";
final File optimizedDexOutputPath = getDir("outdex", 0);
DexClassLoader dLoader = new DexClassLoader(apkFile,optimizedDexOutputPath.getAbsolutePath(),
null,ClassLoader.getSystemClassLoader().getParent());
try {
//How to load all the class of that apk
// How to call the activity
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NoSuchMethodException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}