OSDN Git Service

Avoid using String.format in MediaRecorder
authorHenrik Backlund <henrik.backlund@sonyericsson.com>
Mon, 24 Jan 2011 16:55:46 +0000 (17:55 +0100)
committerJohan Redestig <johan.redestig@sonyericsson.com>
Mon, 24 Jan 2011 16:55:46 +0000 (17:55 +0100)
String.format was used instead of a simple string concatenation.
This is a problem when language is set to Arabic since simple
integers will be converted into Arabic numbers.

Change-Id: I2cbd4c5cd2d09117202e6ae191845fd5fc9154ec

media/java/android/media/MediaRecorder.java

index ecabae8..9e97e92 100644 (file)
@@ -306,7 +306,7 @@ public class MediaRecorder
             degrees != 270) {
             throw new IllegalArgumentException("Unsupported angle: " + degrees);
         }
-        setParameter(String.format("video-param-rotation-angle-degrees=%d", degrees));
+        setParameter("video-param-rotation-angle-degrees=" + degrees);
     }
 
     /**
@@ -425,7 +425,7 @@ public class MediaRecorder
         if (samplingRate <= 0) {
             throw new IllegalArgumentException("Audio sampling rate is not positive");
         }
-        setParameter(String.format("audio-param-sampling-rate=%d", samplingRate));
+        setParameter("audio-param-sampling-rate=" + samplingRate);
     }
 
     /**
@@ -440,7 +440,7 @@ public class MediaRecorder
         if (numChannels <= 0) {
             throw new IllegalArgumentException("Number of channels is not positive");
         }
-        setParameter(String.format("audio-param-number-of-channels=%d", numChannels));
+        setParameter("audio-param-number-of-channels=" + numChannels);
     }
 
     /**
@@ -456,7 +456,7 @@ public class MediaRecorder
         if (bitRate <= 0) {
             throw new IllegalArgumentException("Audio encoding bit rate is not positive");
         }
-        setParameter(String.format("audio-param-encoding-bitrate=%d", bitRate));
+        setParameter("audio-param-encoding-bitrate=" + bitRate);
     }
 
     /**
@@ -472,7 +472,7 @@ public class MediaRecorder
         if (bitRate <= 0) {
             throw new IllegalArgumentException("Video encoding bit rate is not positive");
         }
-        setParameter(String.format("video-param-encoding-bitrate=%d", bitRate));
+        setParameter("video-param-encoding-bitrate=" + bitRate);
     }
 
     /**