1 page.title=API Khun kh Android ICU4J 2 page.tags=androidn 3 page.image=images/cards/card-nyc_2x.jpg 4 5 @jd:body 6 7 <div id="qv-wrapper"> 8 <div id="qv"> 9 <h2>Trong ti liu ny:</h2> 10 <ol> 11 <li><a href="#relation">Lin quan n ICU4J</a></li> 12 <li><a href="#migration">Chuyn nhp t ICU4J sang API android.icu</a></li> 13 <li><a href="#licence">Cp php</a></li> 14 </ol> 15 16 <h2>Xem thm</h2> 17 <ol> 18 <li> 19 <a class="external-link" href="http://userguide.icu-project.org">Ti liu cho ICU4J</a> 20 </li> 21 22 <li> 23 <a class="external-link" href="http://site.icu-project.org/#TOC-What-is-ICU-">Cc tiu chun mi nht c ICU4J 24 h tr</a> 25 </li> 26 </ol> 27 </div> 28 </div> 29 30 <p> 31 ICU4J l b th vin Java m ngun m c s dng rng ri cung cp h tr Unicode 32 v ton cu ha cho cc ng dng phn mm. Android N 33 cung cp mt tp nh cc API ICU4J trong khun kh Android cho cc nh pht trin ng dng 34 s dng trong gi {@code android.icu}. Cc API ny s dng 35 d liu bn a ha c trong thit b. Do , bn c th gim kch thc tp APK 36 bng cch khng bin dch cc th vin ICU4J vo tp APK; thay vo bn c th 37 gi chng trong khun kh mt cch n gin. (Trong trng hp ny, bn c th mun cung cp 38 <a href="{@docRoot}google/play/publishing/multiple-apks.html">nhiu phin bn 39 tp APK</a> nhng ngi dng chy phin bn Android thp hn Android N 40 c th ti phin bn ng dng c cha cc th vin ICU4J.) 41 </p> 42 43 <p> 44 Ti liu ny s bt u bng vic cung cp thng tin c bn v cc mc Android API 45 ti thiu cn h tr cc th vin ny. Sau ti liu s gii thch nhng g 46 bn cn hiu c cng vic trin khai ICU4J lin quan c th n Android. Cui cng, 47 ti liu s cho bn bit cch s dng cc API ICU4J trong khun kh Android. 48 </p> 49 50 <h2 id="relation">Lin quan n ICU4J</h2> 51 52 <p> 53 Android N cung cp mt tp nh cc API ICU4J thng qua 54 gi <code>android.icu</code> thay v gi <code>com.ibm.icu</code>. 55 Khun kh Android c th chn khng 56 cung cp cc API ICU4J v nhiu l do; v d, Android N khng cung cp 57 mt s API b loi b hoc nhng API cha c i ng ICU cng b l 58 bn n nh. V nhm ICU s loi b cc API ny trong tng lai do Android cng s nh du 59 chng l b loi b nhng vn tip tc thm vo. 60 </p> 61 62 <p class="table-caption"><strong>Bng 1.</strong> Cc phin bn ICU v CLDR c s dng 63 trong Android N.</p> 64 <table> 65 <tr> 66 <th>Mc Android API</th> 67 <th>Phin bn ICU</th> 68 <th>Phin bn CLDR</th> 69 </tr> 70 <tr> 71 <td>Android N</td> 72 <td>56</td> 73 <td>28</td> 74 </tr> 75 </table> 76 77 <p>Sau y l mt vi lu quan trng:</p> 78 79 <ul> 80 <li>Cc API khun kh Android ICU4J khng c tt c cc API ca ICU4J.</li> 81 <li>Cc nh pht trin NDK cn bit rng ICU4C Android khng c h tr.</li> 82 <li>Cc API trong khun kh Android khng thay th h tr ca Android cho 83 <a href="{@docRoot}guide/topics/resources/localization.html">vic bn a ha bng 84 cc ti nguyn</a>.</li> 85 </ul> 86 87 <h2 id="migration">Chuyn nhp sang gi android.icu t com.ibm.icu</h2> 88 89 <p> 90 Nu bn s dng cc API ICU4J trong ng dng v 91 cc API <code>android.icu</code> p ng yu cu ca bn th vic chuyn nhp sang 92 cc API ca khun kh i hi bn phi thay i thnh phn nhp vo ca Java 93 t <code>com.ibm.icu</code> sang <code>android.icu</code>. Khi bn c th 94 xa cc tp ICU4J ca bn khi tp APK. 95 </p> 96 97 <p class="note"> 98 <b>Lu </b>: Cc API khun kh ICU4J s dng khng gian tn {@code android.icu} 99 thay v {@code com.ibm.icu}. iu ny l trnh xung t 100 khng gian tn trong cc tp APK c cha cc th vin {@code com.ibm.icu} ca ring chng. 101 </p> 102 103 <h3 id="migrate-from-android"> 104 Chuyn nhp sang cc API android.icu t cc API Android SDK khc 105 </h3> 106 107 <p> 108 Mt s lp trong gi <code>java</code> v<code>android</code> c 109 cc lp tng ng vi cc lp trong ICU4J. Tuy nhin, ICU4J thng cung cp h tr 110 rng hn cho cc tiu chun v ngn ng. 111 </p> 112 <p>Sau y l mt s v d gip bn bt u:</p> 113 <table> 114 <tr> 115 <th>Lp</th> 116 <th>Thay th</th> 117 </tr> 118 <tr> 119 <td><code>java.lang.Character</code> </td> 120 <td><code>android.icu.lang.UCharacter</code> </td> 121 </tr> 122 <tr> 123 <td><code>java.text.BreakIterator</code> </td> 124 <td><code>android.icu.text.BreakIterator</code> </td> 125 </tr> 126 <tr> 127 <td><code>java.text.DecimalFormat</code> </td> 128 <td><code>android.icu.text.DecimalFormat</code> </td> 129 </tr> 130 <tr> 131 <td><code>java.util.Calendar</code></td> 132 <td> 133 <code>android.icu.util.Calendar</code></td> 134 </tr> 135 <tr> 136 <td><code>android.text.BidiFormatter</code> 137 </td> 138 <td><code>android.icu.text.Bidi</code> 139 </td> 140 </tr> 141 <tr> 142 <td><code>android.text.format.DateFormat</code> 143 </td> 144 <td><code>android.icu.text.DateFormat</code> 145 </td> 146 </tr> 147 <tr> 148 <td><code>android.text.format.DateUtils</code> </td> 149 <td><code>android.icu.text.DateFormat</code> 150 <code>android.icu.text.RelativeDateTimeFormatter</code> 151 </td> 152 </tr> 153 </table> 154 155 <h2 id="licence">Cp php</h2> 156 157 <p> 158 ICU4J c pht hnh theo giy php ICU. Hy xem <a class="external-link" href="http://userguide.icu-project.org/icufaq#TOC-How-is-the-ICU-licensed-">Hng dn s dng 159 ICU</a> bit thm chi tit. 160 </p> 161