I have an SHA1.java file sitting in my assets folder of my android project. My question is how do I access the class of that file in my main java file. Is there a way to do such a thing?
I have an SHA1.java file sitting in my assets folder of my android project.
Share
First of all, you need a .class file to load i
Second of all, you can probably create your own ClassLoader and invoke defineClass() from it::
http://download.oracle.com/javase/1.4.2/docs/api/java/lang/ClassLoader.html#defineClass(java.lang.String, byte[], int, int)
You should then do classObj.newInstance() and handle it.
Also, it may make sense to add some wrapper that makes it easy to call SHA1.class – i.e. a single method that performs everything, since you won’t be able to access it without reflection.