android - Unable to use shared preference within a class that extends View -


I'm getting an error when I try to reach shared priority Code> View .

Error: " The method is mandatory for getSharedPreferences (string, int) type ViewforRed ",

where ViewforRed is my square

Here is the sample code

  Public square ViewforRed view {public final string PREFS_NAME = "graphics"; SharedPreferences Settings = Preferred (PREFS_NAME, 0); View public FORRRed (Reference Reference) {Super (Reference); } Public draw on zero (canvas canvas) {paint paint = new paint (); Float p, p1, p2, p3, p4, p5, p6, p7, p8, p 9; }}  

if there is a way of a context object You can try:

  public class ViewforRed extended {public final string PREFS_NAME = "graphics"; Sharing settings; View public FORRRed (reference references) {settings = context.getSharedPreferences (PREFS_NAME, 0); Super (reference); }  

Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -