[Android] Use StringBuilder instead of +

Geoffrey Métais git at videolan.org
Tue Feb 17 17:43:47 CET 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Feb 17 15:13:18 2015 +0100| [c6613c262dd0320388300f955f6e56a2ebe9d4ed] | committer: Geoffrey Métais

Use StringBuilder instead of +

CID #1270696

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=c6613c262dd0320388300f955f6e56a2ebe9d4ed
---

 vlc-android/src/org/videolan/vlc/audio/AudioService.java |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/audio/AudioService.java b/vlc-android/src/org/videolan/vlc/audio/AudioService.java
index a015768..b0dd3a5 100644
--- a/vlc-android/src/org/videolan/vlc/audio/AudioService.java
+++ b/vlc-android/src/org/videolan/vlc/audio/AudioService.java
@@ -1490,12 +1490,12 @@ public class AudioService extends Service {
     }
 
     private synchronized void saveMediaList() {
-        String locations = "";
+        StringBuilder locations = new StringBuilder();
         for (int i = 0; i < mMediaListPlayer.getMediaList().size(); i++)
-            locations += " "+ Uri.encode(mMediaListPlayer.getMediaList().getMRL(i));
+            locations.append(" ").append(Uri.encode(mMediaListPlayer.getMediaList().getMRL(i)));
         //We save a concatenated String because putStringSet is APIv11.
         SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(this).edit();
-        editor.putString("media_list", locations.trim());
+        editor.putString("media_list", locations.toString().trim());
         Util.commitPreferences(editor);
     }
 



More information about the Android mailing list