¾ÛÅøÁî
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°Ç
   
handler¸¦ ÀÌ¿ëÇØ °¡º¯½Ã°£ ¹Ýº¹ ÀÛ¾÷Çϱâ.
±Û¾´ÀÌ : ±èº´ÁÖ                   ³¯Â¥ : 2012-11-26 (¿ù) 15:19 Á¶È¸ : 8614
ÁÖ±âÀûÀÎ ¹Ýº¹ÀÛ¾÷À¸·Î TimerTask ³ª CountDownÀ» ¾²´Â ¹æ¹ýµµ ÀÖ½À´Ï´Ù.
Àúµµ À§ÀÇ ¹æ¹ýÀ» »ç¿ëÇÏ´Ù°¡ À§ µÎ ¹æ¹ýÀÇ °øÅëÀûÀÎ ´ÜÁ¡Àº, ÁÖ±âÀÇ ½Ã°£À» ¸¶À½´ë·Î º¯°æÇÒ ¼ö
¾ø´Ù´Â Á¡ÀÔ´Ï´Ù.
 
TimerTask´Â timerÀÇ ½ºÄÉÁì¿¡ ÀÇÇØ ÀÏÁ¤ÇÑ ½Ã°£À¸·Î ¹Ýº¹µÇ°í,
CountDown ¿ª½Ã ÃʱⰪ¿¡ ÀÇÇØ ½Ã°£ÀÌ ´Ù µÉ ¶§±îÁö ¹Ýº¹ÀÛ¾÷À» ÇÕ´Ï´Ù.
 
TimerTask´Â »ç¿ëÀÚ°¡ ½ºÄÉÁìÀ» cancelÇÏÁö ¾Ê´Â ÀÌ»ó ²¨ÁöÁö ¾Ê´Â ¹«ÇÑ ¹Ýº¹ÀÌ°í,
CountDownÀº ¹Ý´ëÀÇ °æ¿ìÁÒ.
 
°£´ÜÇÑ ¹Ýº¹ ÀÛ¾÷¿¡´Â ¹«¸®°¡ ¾øÀ» Áö ¸ð¸£³ª, ³×ÀÌÆ®¿Â ó·³ ½Ã°£À» Á¡Á¡ ´Ã·Á°¡¸ç ÁÖ±â½Ã°£À» ´Ã¸±
¼ö´Â ¾ø¾î¼­ HandlerÀÇ sendEmptyMessageDelayed¸¦ »ç¿ëÇß½À´Ï´Ù.
 
¿ø¸®´Â Á¤ÀÇÇÑ xÃʸ¸Å­ÀÇ ½Ã°£ µÚ¿¡ handler¿¡°Ô ¸Þ¼¼Áö¸¦ ½î°í handler´Â ´Ù½Ã ÇØ´ç method¸¦
 
ºÎ¸¨´Ï´Ù.
 
ÀÌ·±½ÄÀ¸·Î ÇÏ¸é »ç¿ëÀÚ°¡ ÁßÁöÇÏ°í ½ÍÀº ½Ã°£À» ¼³Á¤ÇÒ ¼öµµ ÀÖ°í, ¸Þ¼¼Áö¸¦ ¹ÞÀ»¶§¸¶´Ù °¡º¯ÀûÀ¸·Î
 
½Ã°£À» Á¶Á¤ÇÏ¿© ½ÃÀÛ½Ãų¼öµµ ÀÖÁÒ.
 
¿ì¼± handlerÂÊÀ» º¾½Ã´Ù.
 
long reconnectionTime = 1000;
long limitTime = 3600000;
Handler connectionHandler = new Handler()
  {
   @Override
   public void handleMessage(Message msg) {
    // TODO Auto-generated method stub
    switch (msg.what) {
    case 0:
     
     if(reconnectionTime <= ( limitTime /2))
     {
     reconnectionTime = reconnectionTime*2;
     Log.d("connectionRetry", "reconnectionTime : "+reconnectionTime);
      try{
      handlerconnect();
      }catch (Exception e) {
      // TODO: handle exception
      e.printStackTrace();
      }
     }
     else
     {
     reconnectionTime =  limitTime ;
     Log.d("connectionRetry", "reconnectionTime : "+reconnectionTime);
      try{
      handlerconnect();
      }catch (Exception e) {
      // TODO: handle exception
      e.printStackTrace();
      }
     }
     
     break;
     
     
    case 1:
        Log.d("connectionRetry", "Login_success_full...handler work end....");
     break;
    
    }
    
    super.handleMessage(msg);
   }
   
  };
  
handler¿¡¼­´Â 0À» ¹ÞÀ»¶§¸¶´Ù ¸Þ¼¼Áö µô·¹À̽ð£À» 2¹è¾¿ ´Ã¸®°í, ÇÑ°è½Ã°£ÀÎ 10ºÐ¿¡ µµ´ÞÇϸé
 
´õÀÌ»ó Áõ°¡ÇÏÁö ¾Ê°í 10ºÐ¸¶´Ù Çѹø¾¿ ¸Þ¼¼Áö¸¦ ½õ´Ï´Ù.
 
´ÙÀ½Àº handlerconnect(); ÀÔ´Ï´Ù.
 
 public void hanadlerconnect()
  {
   int rend=0;
   Random rand = new Random();
   rend = Math.abs(rand.nextInt()%9);
  if(rend ==6)
  {
   connectionHandler.sendEmptyMessageDelayed(1, 1000);
  }else
  {
   connectionHandler.sendEmptyMessageDelayed(0, reconnectionTime);
  }
  }
 
rend °ªÀÌ 6ÀÌ¸é ¹Ýº¹ÀÛ¾÷À» ¸ØÃß°í, Á¾·áÇÕ´Ï´Ù.
rend °ªÀÌ 6ÀÌ ¾Æ´Ï¸é µô·¹ÀÌ°ªÀ» Çڵ鷯¿¡ ÀÇÇØ 2¹è¾¿ ´Ã·Á°¡¸ç ÀÛ¾÷À» ¹Ýº¹ÇÕ´Ï´Ù.
 
¹°·Ð ¾²·¹µå¸¦ »ç¿ëÇصµ °¡´ÉÇÕ´Ï´Ù. ´Ü, ¾²·¹µå »ç¿ë½Ã¿¡´Â ¹Ýµå½Ã ±× °´Ã¼°¡ Á¾·áµÇ°Å³ª
 
wait»óÅ À̾î¾ß °ÙÁÒ.
 
Ȥ½Ã¶óµµ °¡º¯½Ã°£À» °®´Â ¹Ýº¹ÀÛ¾÷ÀÌ ÇÊ¿äÇϽźеéÀº ½ºÄÉÁì·¯ ´ë½Å À̹æ¹ýÀ» ¾²´Â°Íµµ
 
ÁÁÀº ¹æ¹ýÀÏ °Ì´Ï´Ù.
* ±ÛÀ» µî·ÏÇϽǶ§ ²À ÇÊ¿äÇÑ °æ¿ì°¡ ¾Æ´Ï¸é °³ÀÎÁ¤º¸¸¦ ³²±âÁö ¸¶¼¼¿ä ^^ (¿¬¶ôó,À̸ÞÀÏÁÖ¼Ò,Áֹεî·Ï¹øÈ£ µî)




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


   

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