¾ÛÅøÁî
46.¢½.168.138
46.¢½.168.129
46.¢½.168.161
46.¢½.168.136
46.¢½.168.145
46.¢½.168.162
46.¢½.168.144
46.¢½.168.140
115.¢½.135.198
46.¢½.168.139
 
°Ô½Ã¹° 88°Ç
   
The content of the adapter has changed but ListView ... ¿¡·¯ ÀϹÝÀû ÇØ°á¹ý.
±Û¾´ÀÌ : ±èº´ÁÖ                   ³¯Â¥ : 2013-04-16 (È­) 16:39 Á¶È¸ : 15604
¿À·ù³»¿ëÀº 
java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only from the UI thread.

ÀΰÍÀ» ±âÁØÀ¸·Î ÇÕ´Ï´Ù.

±âº»ÀûÀ¸·Î ¾Èµå·ÎÀ̵å´Â  1thread¿¡ ÇÏÀ§ threadµé(ºÎ¸ð-ÀÚ½Ä ¾²·¹µå)·Î µ¿ÀÛÇϸç UIº¯°æÀº ¹Ýµå½Ã ºÎ¸ð, Áï ÇöÀçÀÇ mainThread¿¡ ÀÇÇØ º¯°æµÇ¾î¾ß µË´Ï´Ù.

¸ÞÀξ²·¹µå ÀÌ¿ÜÀÇ °÷¿¡¼­ ´Ù¸¥ thread¸¦ »ý¼ºÇÏ¿© ÀÌ°÷¿¡¼­ ó¸®ÇÏ·Á°íÇϸé 100%¿À·ù¸¦ ¹ß»ý½Ãŵ´Ï´Ù.

¿¹¸¦µé¾î thread¸¦ ÀÌ¿ëÇØ ¸®½ºÆ®¸¦ °»½ÅÇÑ´Ù°íÇսôÙ. À̶§, adapter.notifyDataSetChanged()¸¦ »ç¿ëÇÏ°Ô µÇ¸é À§ÀÇ ¿¡·¯Äڵ带 ¸¸³ª°Ô µÇ½Ç °Ì´Ï´Ù.

ÇØ°áÇÏ´Â °¡Àå ½¬¿î¹æ¹ýÀ¸·Î´Â runOnUiThread¸¦ ÀÌ¿ëÇÏ¿© ÇÏ´Â ¹æ½Ä°ú handler.post·Î ÄÁÆ®·Ñ ÇÏ´Â ¹æ½ÄÀÌ ÀÖ½À´Ï´Ù.

runOnUiThread´Â

runOnUiThread(new Runnable() {

@Override

public void run() {

// TODO Auto-generated method stub

adapter.notifyDataSetChanged();

}

});


handler´Â 


handler.postDelayed(new Runnable() {

@Override

public void run() {

// TODO Auto-generated method stub

try{

adapter.notifyDataSetChanged();

    }catch (Exception e) {

// TODO: handle exception

    }

 }

 }, 100);


µÎ°¡Áö ¹æº÷ÀÔ´Ï´Ù.


¹°·Ð °Ü¿ì ÀÌ°ÍÀ» ¼³¸íÇÏ°íÀÚ ±ÛÀ»¾´°Ç ¾Æ´ÏÁö¸¸ ±âº»ÀûÀÎ »ç¿ëÀº À§¿Í°°´Ù´Â°ÍÀÌÁÒ.


º»·ÐÀ¸·Î µ¹¾Æ°¡¼­..


ºÐ¸í ¾²·¹µå¾È¿¡¼­ À§ÀÇ runOnUiThread ȤÀº Handler·Î ó¸®Çؼ­ °»½ÅÇصµ À§ÀÇ ¿¡·¯¸¦ ¶Ç ¹ñ´Â°æ¿ì°¡


ÀÖ½À´Ï´Ù. ¸¹Àº °³¹ßÀÚµéÀÌ ÀÚÁÖ ¹üÇÏ´Â ¿À·ùÁß¿¡ Çϳª°¡ ¹Ù·Î ÀÌ ºÎºÐÀÔ´Ï´Ù.


À§ÀÇ µÎ°¡Áö¹æ¹ýÀ¸·Î Çߴµ¥µµ ¸¸¾à À§ÀÇ ¿À·ù°¡ ¹ß»ýÇÑ´Ù¸é


´ÙÀ½À» È®ÀÎÇغ¸½Ã±â ¹Ù¶ø´Ï´Ù.


1.ListViewÀÇ °ªÀÌ º¯°æµÇ¾î ¼öÁ¤ÇÏ°í adapter.notifyDataSetChanged(); »ç¿ëÇÏ°í

  ¹Ù·Î ¸®½ºÆ® ½ºÅ©·ÑÀ» ¼öÁ¤ÇÔ.


2. adapter.notifyDataSetChanged();¸¦ »ç¿ëÇÏ°í ¾Æ·¡¿¡ Çڵ鷯·Î Çѹø´õ ListView½ºÅ©·Ñ º¯°æ.


1¹øÀÇ °æ¿ì´Â ¿ì¼± list.setSelection°ú adapter.notifyDataSetChanged();´Â


°°ÀÌ »ç¿ëÇÒ ¼ö ¾ø´Ù´Â°É ¸»Çص帮°Ú½À´Ï´Ù.


¹°·Ð °°ÀÌ »ç¿ëÇÒ ¼ö´Â ÀÖ½À´Ï´Ù. ´Ù¸¸ ¾îµªÅÍÀÇ º¯°æÀÌ ¾ðÁ¦³¡³ª´ÂÁöµµ ¸ð¸£´Âµ¥ .setselectionÀ» ÀÌ¿ëÇØ 


½ºÅ©·ÑÀ» ¼öÁ¤Çϸé Áߺ¹Çؼ­ getView¸¦ ¶Ç ºÒ·¯¿Í À§ÀÇ ¿¡·¯¸¦ ¹ñ½À´Ï´Ù.


°°Àº adapter.notifyDataSetChanged();¸¦ ¿©·¯¹ø ºÎ¸£´Â°Ç »ó°ü¾ø½À´Ï´Ù. ´Ù¸¸ adapter.notifyDataSetChanged();Àº °ªÀÌ º¯°æµÇ¾îÀÖÀ»°æ¿ì ÀÛµ¿ÇÏÁö¸¸ list.setSelectionÀº 


¹«Á¶°Ç ÀÛµ¿ÇÕ´Ï´Ù. Â÷ÀÌÁ¡ÀÌ Å©¹Ç·Î ¹Ýµå½Ã ±¸ºÐÇÏ¿© »ç¿ëÇϽñ⠹ٶø´Ï´Ù.


µÎ¹ø°·Î´Â runonuithread¾È¿¡ ¶ÇÇѹø handler·ÎÀÇ ÄÁÆ®·ÑÀÔ´Ï´Ù.


runon¿¡¼­ adapter.notifyDataSetChanged(); ¸¦ ºÎ¸£°í handler¿¡¼­ setSelection ȤÀº 

¸®½ºÆ®½ºÅ©·Ñ º¯°æÀ» ÇÏ½Ç °æ¿ì ¿¡·¯°¡ ¹ß»ýµÉ¼ö ÀÖ½À´Ï´Ù.


³»¿ëÀÌ Ãß°¡µÇ°Å³ª ¼öÁ¤µÈ °ÍÀ» º¸¿©ÁÖ°í ½Í´Ù¸é ±×³É ´ÜÇѹøÀÇ adapter.notifyDataSetChanged();


¸¦ ºÎ¸£¸éµÇ°í ¸¸¾à °»½Å+ ½ºÅ©·ÑÀ» ÇÏ°í ½Í´Ù¸é ´Ü¼øÈ÷ setSelection¸¸ ºÒ·¯ÁÖ¸é µË´Ï´Ù.


¾Æ¹«ÂÉ·Ï ¸®½ºÆ®ºä °»½ÅÇÏ´Ù°¡ À§ÀÇ ¹®Á¦°¡ °è¼Ó ¹ß»ýÇÑ´Ù¸é ¾îµð¼±°¡ Áߺ¹ °»½Å ¹× ¸®½ºÆ® ½ºÅ©·Ñ ÄÁÆ®·ÑÇÏ°í 


ÀÖ´Â ºÎºÐÀº ÀÚÁ¦ÇϽø鼭 ÀÛ¾÷ÇϽñ⠹ٶø´Ï´Ù.


* ±ÛÀ» µî·ÏÇϽǶ§ ²À ÇÊ¿äÇÑ °æ¿ì°¡ ¾Æ´Ï¸é °³ÀÎÁ¤º¸¸¦ ³²±âÁö ¸¶¼¼¿ä ^^ (¿¬¶ôó,À̸ÞÀÏÁÖ¼Ò,Áֹεî·Ï¹øÈ£ µî)




±èº´ÁÖ ´ÔÀÇ Tip&Tech ÃÖ½Å±Û [´õº¸±â]


   

°Ô½Ã¹° 88°Ç
¹øÈ£ Á¦¸ñ ±Û¾´ÀÌ ³¯Â¥ Á¶È¸
88  <Ŭ¶ó¿ìµåÇõ½Å¼¾ÅÍ> 12¿ù 1ÀÏ SW ½ºÅ¸Æ®¾÷ â¾÷ ¼º°ø Àü·« ¼¼¹Ì³ª Âü¼® ¿äû Áظð 11-30 4086
87  <Ŭ¶ó¿ìµåÇõ½Å¼¾ÅÍ> 12¿ù 1ÀÏ SW ½ºÅ¸Æ®¾÷ â¾÷ ¼º°ø Àü·« ¼¼¹Ì³ª Áظð 11-23 3941
86  °³Àΰ³¹ßÀÚ SW°³¹ßȯ°æ Áö¿ø»ç¾÷ ¾È³» Áظð 10-28 4232
85  ¸Æ¿¡¼­ ±¸±Û API key µî·Ï¹æ¹ý ¼º±âµ¿ 08-29 4598
84  [Agate Mobile] ¾Û ¼³Ä¡ ¾øÀÌ ¼­¹ö·ÎºÎÅÍ ½Ç½Ã°£ ·Îµù µÇ¾î µ¿ÀÛÇÏ´Â Cloud Native App ÇÁ·¹ÀÓ¿öÅ©ÀÔ´Ï´Ù. ¾¾Æ®¸°°³¹ß¡¦ 07-21 7873
83     [Agate Mobile] ¾Û ¼³Ä¡ ¾øÀÌ ¼­¹ö·ÎºÎÅÍ ½Ç½Ã°£ ·Îµù µÇ¾î µ¿ÀÛÇÏ´Â Cloud Native App ÇÁ·¹ÀÓ¿öÅ©ÀÔ´Ï´Ù. ±èÀºÈ£ 08-21 12267
82  ÀÚ¹Ù Ãʺ¸µé¿¡°Ô ÃßõÇÏ´Â ±âÃÊ °³³äÀ» ÀâÀ» ¼ö Àִ åµé ÀÌ°æ¿ë 06-19 5933
81  [ÆÁ] °¶·°½Ã ³ëÆ®3 °³¹ßÀÚ ¿É¼Ç ¸Þ´º ã±â ^^ ÀÌ°æ¿ë 11-09 9873
80  ¾ÛÅÛÇø´À» Á¦°øÇÏ´Â »çÀÌÆ® ¼Ò°³ÇÕ´Ï´Ù. ¾¾Æ®¸°°³¹ß¡¦ 08-21 12444
79  The content of the adapter has changed but ListView ... ¿¡·¯ ÀϹÝÀû ÇØ°á¹ý. ±èº´ÁÖ 04-16 15605
78  °£´ÜÇÏ°Ô Æнº¿öµå¿¡ ¼ýÀÚ°¡ È¥¿ëµÇ¾ú´ÂÁö ó¸®ÇÒ ¼ö ÀÖ´Â ¸Þ¼ÒµåÀÔ´Ï´Ù. ±èº´ÁÖ 01-31 6659
77  handler¸¦ ÀÌ¿ëÇØ °¡º¯½Ã°£ ¹Ýº¹ ÀÛ¾÷Çϱâ. ±èº´ÁÖ 11-26 8608
76  String -> HEX ±èº´ÁÖ 11-12 6009
75  ¸®½ºÆ® ÀÛ¾÷½Ã¿¡ ±âº»ÀûÀ¸·Î ¾Ë¾ÆµÎ¼Å¾ß µÉÁ¡. +1 ±èº´ÁÖ 10-08 7080
74  xml Á÷·Äó¸® °í¹ü¼® 09-24 4535
73  ÁÖ¼Ò·Ï Ãß°¡/»èÁ¦ °¨ÁöÇؼ­ ¾ÛÀÇ dbÃß°¡/»èÁ¦Çϱâ. ±èº´ÁÖ 09-24 12680
72  È®À帮½ºÆ®°¡ 3µª½º ÀÌ»óÀÌ µÉ±î? ¾ÈµÉ±î? +1 ±èº´ÁÖ 08-21 10356
71  ZXing ¹ÙÄÚµå ½ºÄµºÎºÐ Å©±â Á¶ÀýÇϱâ. ±èº´ÁÖ 08-06 14916
70  ÀÌŬ¸³½º¿¡¼­ ·¹À̾ƿô xml ±×·¡ÇȺκÐÀÌ °©Àڱ⠾Ⱥ¸ÀÏ°æ¿ì. +1 ±èº´ÁÖ 07-27 6648
69  °£¸¸¿¡ ±Û¾²³×¿ä À̹ø¿£ launcherShortCut (¹Ù·Î°¡±â ¾ÆÀÌÄÜ)ÀÔ´Ï´Ù. ±èº´ÁÖ 07-25 12237
 1  2  3  4  5  
 
 
 
Copyright ¨Ï wwwold.androidstudy.co.kr. All rights reserved.