assign external variable to the result of a callback inside AsynckTask
<pre><code>private class exampleTask extends AsyncTask&lt;String, Void, SomeResult&gt;{
    @Override
    protected SomeResult doInBackground(String... urls) {
       SomeResult res ; 
       someMethod(new CallBack&lt;T&gt;(){
              @Override
              public void onResponse(SomeResult something) {
                res = something ; 
             }

            @Override
            public void onFailure() {
                //
            }
       });

     return res ;
    }


    @Override
    protected void onPostExecute() {
        //
    }
}
</code></pre>

<p>Please I want to assign "res" to "something" witch is inside the callback in the onResponse method. In this code it's impossible to assign res inside the onResponse method. </p>

<p>Please any help is welcome. </p>

<p>Thank you :)</p>

<p>my original code : I'd like to assign "url" ;</p>

<pre><code>private class GetBeaconInfosTask extends AsyncTask&lt;String, Void, Call&lt;Url&gt;&gt; {

    Url url ;

    @Override
    protected Call&lt;Url&gt; doInBackground(String... urls) {
        ProxService service = ProxService.Factory.makeProxService(ProxService.ENDPOINT);
        return service.getUrlDetails(urls[0]);
    }

    // onPostExecute return the results of the AsyncTask.
    @Override
    protected void onPostExecute(Call&lt;Url&gt; call) {

        call.enqueue(new Callback&lt;Url&gt;() {
            @Override
            public void onResponse(Call&lt;Url&gt; call, Response&lt;Url&gt; response) {
                url = response.body();
            }

            @Override
            public void onFailure(Call&lt;Url&gt; call, Throwable t) {
                //
            }
        });

        if(url == null){
            Log.i("url is null", "url is null !!!!!  ....");
        }
        else {
        setShopLogo(url.icon) ;
        setShopName(url.title);
        setDescription(url.description);
        setlongUrl(url.longUrl); }
    }

}
</code></pre>