I know we can generate getter and setters by Source -> Generate Getter and Setters... but my question is is there any way we write our own Template for shared preferences getter and setters that can generate all the getter setters against all the data members in exactly the same way as Eclipse does for simple Getter and Setters. Its hectic job when you've a lot to save in preferences. Can eclipse write the following code for me against KEY_SESSTION_TIMEOUT.
private static final String KEY_SESSION_TIMEOUT = "sTimeOut";
public static long getSessionTimeOut()
{
return sp.getLong(KEY_SESSION_TIMEOUT, 30000);
}
public static void setSessionTimeOut(long timeOutSec)
{
editor.putLong(KEY_SESSION_TIMEOUT, timeOutSec).commit();
}