我在Android上使用Andengine。我有两个类(Main和函数),如下所示。Android上的环境和GetSharedPreferences
主营:
private Context myContext;
.
.
if (functions.Sonido(myContext)) {
mSound.play();
}
功能:
public boolean Sonido(Context C) {
prefs = C.getSharedPreferences(Filename, Context.MODE_PRIVATE);
valor = prefs.getString("Sound", null);
if (valor == "YES") {
return true;
}else{
return false;
}
}
编辑不给任何错误,但我得到的运行时错误。请协助我解决它们。
告诉我们您的logcat的...... “我的英语对不起” 嘿嘿没有problem..try 'if(functions.Sonido(this)){mSound.play(); }' –