package edetect.webiscr.cf.e_bookgeneral;
import android.app.ActivityManager;
public class ApplockHandler {
String appg = "com.example.lock";
ActivityManager.killBackgroundProcesses(String appg);
}
错误导致预期
ActivityManager.killBackgroundProcesses(String appg);
我对java和android都很陌生。很抱歉我的noobishness
非常感谢任何帮助:)
答案 0 :(得分:0)
您需要将killBackgroundProcess
放入函数中,并且只传递appg
前面没有String
数据类型的package edetect.webiscr.cf.e_bookgeneral;
import android.app.ActivityManager;
public class ApplockHandler {
private final String appg = "com.example.lock";
public ApplockHandler() {}
public void killLock() {
ActivityManager.killBackgroundProcesses(appg);
}
}
。例如:
^(?:weight\s?)?(\d{1,2})(?:k|kg)$
答案 1 :(得分:0)
从任何函数调用 killBackgroundProcesses 。您还需要获取 ActivityManager 的实例。
public class ApplockHandler {
public ApplockHandler() {}
public void killLock(String appg) {
ActivityManager am = (ActivityManager)this.getSystemService(Context.ACTIVITY_SERVICE);
am.killBackgroundProcesses(appg);
}
}
现在通过传递包名称从任何地方调用此 killLock 方法。