On Mon, Feb 6, 2012 at 12:56 PM, TreKing <[email protected]> wrote:
> On Mon, Feb 6, 2012 at 11:36 AM, John-Marc Desmarais <[email protected]> wrote:
>>
>> How do I handle the byte[] settingsBuffer = new byte[(int)
>> inputFile.length]; without opening a File?
>
>
> You get the stream of data as the returned value of openFileInput. Then you
> can then read that into a byte array of the input's length. So your settings
> buffer would be initialized AFTER you open the input stream, using the
> stream's length.
Hi
Based on your first response I have tried the following:
public void onPause()
{
super.onPause();
// save configuration settings
SharedPreferences.Editor settingsEditor =
getSharedPreferences(settingsFile, 0).edit();
settingsEditor.putString("RXConfigurationSettings",
Base64.encodeToString(cfg.toSerializedBytes(getBaseContext()),
Base64.DEFAULT));
}
public void loadSettings()
{
SharedPreferences settings = getSharedPreferences(settingsFile,
0);
if (settings.contains("RXConfiguration"))
{
cfg =
RXConfigurationSettings.fromSerializedBytes(Base64.decode(settings.getString("RXConfigurationSettings",
""), Base64.DEFAULT));
}
else
{
Log.e(LogName.className, "Input settings not found.");
}
}
And am now getting "Input settings not found" when closing and
reopening my application.
-jm
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en