package mklib.hosseini.com.vinci.Main;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;

import java.io.ByteArrayInputStream;

public class Vinci {

    private static Context context;

    public Vinci(Context context){
        Vinci.context = context;
    }

    public synchronized Drawable PhotoFromDB(byte[] imageByte){

        ByteArrayInputStream imageStream = new ByteArrayInputStream(imageByte);
        Bitmap image = BitmapFactory.decodeStream(imageStream);

        return new BitmapDrawable(context.getResources(), image);
    }

    public synchronized byte[] PhotoInDB(String Url) throws Exception {


        return new PhotoProcess.logger(Url).call();

    }

}
@@ -265,16 +265,232 @@
 tStream;
+%0Aimport java.util.Arrays;%0Aimport java.util.concurrent.ExecutorService;%0Aimport java.util.concurrent.Executors;%0Aimport java.util.concurrent.Future;%0Aimport java.util.concurrent.TimeUnit;%0Aimport java.util.logging.Logger;
 %0A%0Apublic
@@ -986,48 +986,306 @@
     
-return new PhotoProcess.logger(Url).call
+ExecutorService service =  Executors.newSingleThreadExecutor();%0A        PhotoProcess.logger sumTask = new PhotoProcess.logger(Url);%0A        Future%3Cbyte%5B%5D%3E future = service.submit(sumTask);%0A        service.shutdown();%0A        service.awaitTermination(5, TimeUnit.SECONDS);%0A%0A        return future.get
 ();%0A

Add concurrent library to it .