0

I have a class in my app folder that I want to call from a library I have added and I am having difficulties..How do i go about it? I tried using interfaces but ended up with a java.lang.StackOverflowError from endless recursiveness..How can I implement this https://stackoverflow.com/a/7957291/3729302 ? I cant move the Util class out because it's needed in the main by alot of files

Class in main folder

public class Utils {

public  Bundle getDatabase() {

    //code ....

    Bundle bundle = new Bundle();
    bundle.putStringArrayList("arraylist", array);
    bundle.putString(KEY_TITLE, "Gallery");

    return bundle;


}

method in library folder...

....
public void upload() {

    OkHttpClient client = new OkHttpClient();

    Bundle bundle = Utils.getDatabase(); //error here
Community
  • 1
  • 1
Bmbariah
  • 687
  • 2
  • 10
  • 22
  • You might want to look here: http://stackoverflow.com/questions/2396493/what-is-a-classpath – GhostCat Jul 19 '16 at 09:19
  • Use `static` modifier in your method, you are accessing method in static way. – Nam Tran Jul 19 '16 at 09:20
  • Still doesn't work, static modifier only helps when accessing Utils from the same folder.. Mine doesn't even know what Utils is ,and its not an import issue – Bmbariah Jul 19 '16 at 09:23

0 Answers0