Back to project page Bussan.
The source code is released under:
Copyright 2011 Kristian Bendiksen. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: ...
If you think the Android project Bussan listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package no.kriben.bussan; //from w w w.j a va2 s. co m import java.util.ArrayList; import java.util.List; import java.lang.Integer; public class PreferencesUtil { public static List<Integer> decodeBusStopString(String string) { ArrayList<Integer> favorites = new ArrayList<Integer>(); if (string.length() == 0) return favorites; String[] parts = string.split(","); for (String part : parts) { favorites.add(Integer.valueOf(part)); } return favorites; } public static String encodeBusStopString(List<Integer> busStops) { String encoded = ""; if (busStops.size() == 0) return encoded; for (Integer b : busStops) { encoded += b.toString() + ","; } // Remove the last delimiter return encoded.substring(0, encoded.lastIndexOf(",")); } }