So, I have a public static Bitmap
with a delay of 2000 mils inside of it. My problem is that I get return
before code that is getting delayed is executed.
To give you the idea of my function structure:
public static Bitmap getBitmapFromWebview(WebView webView){
*******************some code here
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
********************declaring bm bitmap
Log.i("DelayD", "Delay");
}
}, 2000);
Log.i("DelayD", "Return");
return bm;
}
I've set up 2 debug messages - inside the delayed section, and one right before the return
.
Here's what I get in the logcat:
08-11 20:45:13.520 I/DelayD: Return
08-11 20:45:16.173 I/DelayD: Delay
as well as an Error messages, which I'm not sure are relevant:
08-11 20:44:45.170 E/Sensors: new setDelay handle(0),ns(66667000)m, error(0), index(2)
08-11 20:44:48.082 E/Sensors: new setDelay handle(0),ns(66667000)m, error(0), index(2)