24 lines
585 B
Java
24 lines
585 B
Java
package com.xscm.moduleutil.service;
|
|
|
|
import android.content.Context;
|
|
import android.os.Handler;
|
|
|
|
import java.lang.ref.WeakReference;
|
|
|
|
public class HandlerUtil extends Handler {
|
|
|
|
private static HandlerUtil instance = null;
|
|
WeakReference<Context> mActivityReference;
|
|
|
|
public static HandlerUtil getInstance(Context context) {
|
|
if (instance == null) {
|
|
instance = new HandlerUtil(context.getApplicationContext());
|
|
}
|
|
return instance;
|
|
}
|
|
|
|
HandlerUtil(Context context) {
|
|
mActivityReference = new WeakReference<>(context);
|
|
}
|
|
}
|