我想检查服务是否正在运行l写了这段代码
public class startServiceOrNo {
public static void startServiceIfItsNotRuning(Class<?> class1, Context context) {
ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
if (class1.getName().equals(service.service.getClassName())) {
Lg.d("servisstart SERVICE ALREADY START" + class1.getName());
return;
}
}
Lg.d("servisstart SSERVICE NEW SERVIS " + class1.getName());
context.startService(new Intent(context, class1));
}
Run Code Online (Sandbox Code Playgroud)
并使用它startServiceOrNo.startServiceIfItsNotRuning(OfflineChopsMonitor.class,this)
如果我检查来自一个类的服务它的工作,但如果我检查来自不同类的相同服务,它的检查不起作用
如果我SeekBar在所有进度线中设置绘制"进度可绘制" 我得到bgdraw.如何从开始到拇指位置设置绘图?
如何在此代码中在Runnable上设置id
Runnable rd = new Runnable() {
@Override
public void run() {
populatePanel(referList.get(handler.getPosition()), handler.getPosition());
if (i == referList.size() - 1) {
i = 0;
}
}
};
handler.postDelayed(rd, delay);
Run Code Online (Sandbox Code Playgroud)
我想区分一个线程与其他线程