com.googlecode.android_scripting.facade
Class PreferencesFacade

java.lang.Object
  extended by com.googlecode.android_scripting.jsonrpc.RpcReceiver
      extended by com.googlecode.android_scripting.facade.PreferencesFacade

public class PreferencesFacade
extends RpcReceiver

This facade allows access to the Preferences interface.
Notes:
filename - Filename indicates which preference file to refer to. If no filename is supplied (the default) then the SharedPreferences uses is the default for the SL4A application.
prefPutValue - uses "MODE_PRIVATE" when writing to preferences. Save values to the default shared preferences is explicitly disallowed.

See Preferences and Shared Preferences in the android documentation on how preferences work.

Author:
Robbie Matthews (rjmatthews62@gmail.com)

Constructor Summary
PreferencesFacade(FacadeManager manager)
           
 
Method Summary
 java.util.Map<java.lang.String,?> prefGetAll(java.lang.String filename)
           
 java.lang.Object prefGetValue(java.lang.String key, java.lang.String filename)
           
 void prefPutValue(java.lang.String key, java.lang.Object value, java.lang.String filename)
           
 void shutdown()
          Invoked when the receiver is shut down.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PreferencesFacade

public PreferencesFacade(FacadeManager manager)
Method Detail

prefGetValue

@Rpc(description="Read a value from shared preferences")
public java.lang.Object prefGetValue(@RpcParameter(name="key")
                                                    java.lang.String key,
                                                    @RpcParameter(name="filename",description="Desired preferences file. If not defined, uses the default Shared Preferences.")@RpcOptional
                                                    java.lang.String filename)

prefPutValue

@Rpc(description="Write a value to shared preferences")
public void prefPutValue(@RpcParameter(name="key")
                                        java.lang.String key,
                                        @RpcParameter(name="value")
                                        java.lang.Object value,
                                        @RpcParameter(name="filename",description="Desired preferences file. If not defined, uses the default Shared Preferences.")@RpcOptional
                                        java.lang.String filename)
                  throws java.io.IOException
Throws:
java.io.IOException

prefGetAll

@Rpc(description="Get list of Shared Preference Values",
     returns="Map of key,value")
public java.util.Map<java.lang.String,?> prefGetAll(@RpcParameter(name="filename",description="Desired preferences file. If not defined, uses the default Shared Preferences.")@RpcOptional
                                                                          java.lang.String filename)

shutdown

public void shutdown()
Description copied from class: RpcReceiver
Invoked when the receiver is shut down.

Specified by:
shutdown in class RpcReceiver