报错信息:
Fatal Exception: java.lang.IllegalStateException
Fragment MonitorFragment{7e39b48} not attached to Activity
处理:
加isAdded():
public String getStrByResId(int ResId) {
if (isAdded() && getActivity() != null ){
String content = getResources().getString(ResId);
return ItStringUtil.safeToString(content);
}else{
return "";
}
}