blob: 7dfd5ddd988d3da7d5a39d4d136134693e4b9df9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
package com.mapbox.mapboxsdk.utils;
import android.os.Looper;
import com.mapbox.mapboxsdk.exceptions.CalledFromWorkerThreadException;
public class ThreadUtils {
/**
* Validates if execution is occuring on the main thread.
*/
public static void checkThread(String origin) {
if (Looper.myLooper() != Looper.getMainLooper()) {
throw new CalledFromWorkerThreadException(
String.format("%s interactions should happen on the UI thread.",origin));
}
}
}
|