[Android] Use one StringBuilder per MediaWrapper instance

Geoffrey Métais git at videolan.org
Thu Oct 12 11:12:55 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Oct 12 10:26:59 2017 +0200| [4e6de52e50835127ca57118addcf2ded0f18c2ed] | committer: Geoffrey Métais

Use one StringBuilder per MediaWrapper instance

> https://code.videolan.org/videolan/vlc-android/commit/4e6de52e50835127ca57118addcf2ded0f18c2ed
---

 medialibrary/src/org/videolan/medialibrary/media/MediaWrapper.java | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/medialibrary/src/org/videolan/medialibrary/media/MediaWrapper.java b/medialibrary/src/org/videolan/medialibrary/media/MediaWrapper.java
index de8e18c22..4670e1685 100644
--- a/medialibrary/src/org/videolan/medialibrary/media/MediaWrapper.java
+++ b/medialibrary/src/org/videolan/medialibrary/media/MediaWrapper.java
@@ -81,8 +81,6 @@ public class MediaWrapper extends MediaLibraryItem implements Parcelable {
     //Various
     public final static int META_APPLICATION_SPECIFIC = 250;
 
-    private static final StringBuilder sb = new StringBuilder();
-
     // threshold lentgh between song and podcast ep, set to 15 minutes
     private static final long PODCAST_THRESHOLD = 900000L;
 
@@ -140,7 +138,7 @@ public class MediaWrapper extends MediaLibraryItem implements Parcelable {
         init(time, length, type, null, title, artist, genre, album, albumArtist, width, height,
                 artworkURL != null ? VLCUtil.UriFromMrl(artworkURL).getPath() : null, audio, spu,
                 trackNumber, discNumber, lastModified, seen, null);
-        sb.setLength(0);
+        final StringBuilder sb = new StringBuilder();
         if (type == TYPE_AUDIO) {
             boolean hasArtistMeta = !TextUtils.isEmpty(artist);
             boolean hasAlbumMeta = !TextUtils.isEmpty(album);



More information about the Android mailing list