I finally managed to get an object out of an AsyncTask (DogAsyncTask) with an interface/listener (DogListener):
public String fout(String url) {
    Dog d_in = new Dog("DogName");
    DogAsyncTask task = new DogAsyncTask(d_in);
    final String out = "";    <---Have tried but error for out becomes "The final local variable out cannot be assigned, since it is defined in an enclosing type"
    task.setDogListener(new DogListener()
    {
        @SuppressWarnings("unchecked")
        @Override
        public void DogSuccessfully(String data) {  <---The string I want to get
            Log.e("DogListened", data);
            out = data;
        }
        @Override
        public void DogFailed() {}
    });
    task.execute(url);
    return out;
}
My main activity calls this function (fout) and is supposed to get a String out of it. String data is already there and Log.e("DogListened", data); records it too. How can I return that outwards to my main activity? I have tried setting out = data and made out a final String on the outside but the "final local variable out cannot be assigned, since it is defined in an enclosing type" error comes up. How can I get around this?
Thanks
 
     
     
    