Advertisement
Guest User

Untitled

a guest
Jul 24th, 2014
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.31 KB | None | 0 0
  1. byte[] bytes = someBytes(); // Original array, contains 5039 bytes
  2.  
  3. String toStore = new String(bytes);
  4.  
  5. sharedPreferences.edit().putString("Data", toStore).apply();
  6.  
  7. String fromStore = sharedPreferences.getString("Data", "");
  8.  
  9. byte[] readBytes = fromStore.getBytes(); // Read array, contains 8907 bytes. WHY?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement