此子類如何訪問Livewallpaper服務中的父類。Livewallpaper服務類中的訪問子方法
public class LiveWallpaperService extends WallpaperService
{
public static final String SHARED_PREFS_NAME="t_settings";
public static final String strSharedPrefs="t_settings";
@Override
public Engine onCreateEngine()
{
return new LiveWallpaperWallpaperEngine();
}
public static void updatePreferences()
{
//This is the class that needs to access the child method.
Log.w("yo", "resumed from main activity");
}
public class LiveWallpaperWallpaperEngine extends Engine implements SharedPreferences.OnSharedPreferenceChangeListener
{
//This is the child method I'm trying to access.
public void updatePreferencesB(){}'
我使用抽象,我不能,因爲它的應用程序崩潰也靜態不允許我做出對象的任何更改嘗試。
的
public static void updatePreferences
是當首活性被破壞,測試和工程調用。現在我只需要一種方法來找出如何在調用onDestroy時訪問主要活動源的子方法。
Olly。
你似乎已經實現了''OnSharedPreferenceChangeListener'',我不禁想知道你需要這個靜態''updatePreferences''嗎? – harism 2012-02-05 21:46:51