ÀÌÀü¿¡ Çѹø ÇØ°áÇß¾ú´ø ¹®Á¦Àε¥ ³Ê¹« ¿À·¡ÀüÀ̶ó ±â¾ïÀÌ ³ªÁú¾Ê¾Æ ±¸±Û¸µÀ¸·Î ½ÃµµÇغÃÀ¸³ª
µ¥ÀÌÅÍ°¡ ¾Èµé¾î°¡´Â ¹®Á¦°¡ ÀÖ¾î Áú¹® ¿Ã¸³´Ï´Ù..;
csvÆÄÀÏÀ» Àоî¿Ô´Âµ¥ AÇà¿¡ ´ëÇÑ ³»¿ë¸¸ ÀÐÇôÁÖ°í ½Í¾î¼ ¾Æ·¡¿Í °°ÀÌ Äڵ带 Â¥¼
ÀÐÀº lineÀ» ½ºÇø´À¸·Î ²÷¾îÁÖ°í 0¹ø° À妽º¸¸ list¿¡ »ðÀÔÇØÁÖµµ·Ï Çߴµ¥, µ¥ÀÌÅÍ°¡ µé¾î°¡Áú ¾Ê³×¿ä.
¿À·ù°¡ ¹ß»ýÇÏ´Â°Ç ¾Æ´Ï³ª Log¸¦ Âï¾îº¸¾Æµµ ¹¬¹¬ºÎ´ä.. µ¥ÀÌÅÍ°¡ ¾Æ¿¹ ¾Èµé¾î°¡´Â µí ÇØ¿ä.
À߸øµÈ ºÎºÐÀÌ ÀÖ³ª¿ä?
InputStreamReader inputreader = new InputStreamReader(this.getAssets().open("dic.csv"), "euc-kr"); BufferedReader buffereader = new BufferedReader(inputreader); List<String> list = new ArrayList<String>(); String line;
do { line = buffereader.readLine(); String[] token = line.split(",", -1); list.add(token[0]); } while(line!=null); |
do{
line = buffereader.readLine();
String[] token = line.split(",", -1);
list.add(token[0]);
Log.d("test : " , String.valueOf(list));
}while(line!=null)
·Î±×´Â ÀÌ·¸°Ô Âï¾ú½À´Ï´Ù!
ÄÚµå »ó¿¡¼ ¹®Á¦´Â ¾ø¾î º¸À̴µ¥ ÆÄÀÏ ÀÚü¸¦ Á¤»óÀûÀ¸·Î Àоî¿À´ÂÁöºÎÅÍ È®ÀÎÇÏ¼Å¾ß ÇÒ °Í °°½À´Ï´Ù.
Ȥ½Ã ¸ð¸£´Ï À¥¼Ä¡¸¦ ÅëÇؼ ºñ½ÁÇÑ °æ¿ì°¡ ÀÖ´ÂÁö È®ÀÎÇϴ°͵µ ÁÁÀ»°Å °°³×¿ä.
¾Æ·¡´Â file size°¡ Ä¿¼ -1·Î ¸®Åϵȴٴ ÄÉÀ̽º°¡ Àִµ¥ ±×ºÎºÐµµ È®ÀÎÇϽÉÀÌ...
https://stackoverflow.com/questions/14515550/inputstream-from-assets-folder-on-android-returning-empty
¾Æ¸¶ ÇØ°á¹æ¾ÈÀº ´Ù¸¥ ´É·ÂÀÚºÐÀÌ ´äº¯ÇØÁÖ½ÃÁö ¾ÊÀ»±î ½Í³×¿ä;; ¤¾