你好
-A-在Appsetting中:
public class AppSettings {
...
public static String getLogFileName(Context context){
SharedPreferences pref = context.getSharedPreferences(GPSLOGGER_PREF_NAME, 0);
return pref.getString(LOG_FILE, "");
}
-B-在主要活动中:
AppLog.logString("Version A 05 Service Started with interval " + interval + ", Logfile name: " + AppSettings.getLogFileName(this));
==>正常工作
-C-但在
public class SmsReceiver extends BroadcastReceiver
File kmlFile = new File(folder.getPath(),AppSettings.getLogFileName(this));
相同的指令“ AppSettings.getLogFileName(this)”,错误为(xxxx):
“这条线上有多个标记
-类型为AppSettings的方法getLogFileName(Context)不适用于参数(SmsReceiver)
-语法错误,插入“)”以完成VariableInitializer”
为什么呢?是否存在简单的解决方法?
编辑:添加'(',但不够
“类型为AppSettings的方法getLogFileName(Context)不适用于参数(SmsReceiver)”
最佳答案
在此行缺少')'吗?
File kmlFile = new File(folder.getPath(),AppSettings.getLogFileName(this); xxxx
尝试
File kmlFile = new File(folder.getPath(),AppSettings.getLogFileName(this));