我相信我有一个简单的问题... 但作为初学者,我再也看不到了
在一个班里,我想从另一个班里拿些Vars
第1类:
package com.blabla;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
public class SMSReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
//get shared preferences
GetSettings test1 = new RingSettings();
String theSMStext = test1.getSMStext();
Boolean theActivateSMS = test1.getActivateSMS();
}
}
第2类:
package com.blabla;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
public class GetSettings {
/**
* @param args
*/
private String SMStext;
private Boolean ActivateSMS;
public static void RingSettings(Context context) {
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
String SMStext = sp.getString("SMStext", "0");
Boolean ActivateSMS = sp.getBoolean("ActivateSMS", false);
}
public String getSMStext(){
return SMStext;
}
public Boolean getActivateSMS(){
return ActivateSMS;
}
}
Eclipse在类1中给我的“RingSettings 无法确定类型”\\gt;在 GetSettings 测试1 = 新的 RingSettings ();
我做错什么了!