title: How could I trigger button event by program every 3 mins?
body: <p>I wrote a view to inquiry data from server,I want user can use button to inquiry and if they don't  have any action,program will trigger button event automatically every 3 mins ? is there anyone have a good idea ? Thanks a lot .</p>
  
  <p>public void jumpToLayout11()    {</p>
  
  <pre><code>        StrictMode
          .setThreadPolicy(new StrictMode.ThreadPolicy.Builder()  
          .detectDiskReads()  
          .detectDiskWrites()  
          .detectNetwork()   // or .detectAll() for all detectable problems  
          .penaltyLog()  
          .build());  
       StrictMode
          .setVmPolicy(new StrictMode.VmPolicy.Builder()  
          .detectLeakedSqlLiteObjects()  
          .detectLeakedClosableObjects()  
          .penaltyLog()  
          .penaltyDeath()  
          .build());
  
       setContentView(R.layout.layout11);
  
          // 定義各 ListView 
          final ListView lvBKNO;
          final ListView lvFITX;
          final ListView lvFIMTX;
          final ListView lvOPTION;
          final ListView lvTOTAL;
          final TextView tvTime;
  
  
  
  
          // 各控件 findViewID
  
          lvBKNO = (ListView)findViewById(R.id.lvBKNO);
          lvFITX = (ListView)findViewById(R.id.lvFITX);
          lvFIMTX = (ListView)findViewById(R.id.lvFIMTX);
          lvOPTION = (ListView)findViewById(R.id.lvOPTION);
          lvTOTAL = (ListView)findViewById(R.id.lvTOTAL);         
          tvTime = (TextView)findViewById(R.id.tvTime);       
  
  
          Button btnLayout11Inq= (Button) findViewById(R.id.btnLayout11Inq);
          Button btnLayout11Back = (Button) findViewById(R.id.btnLayout11Back);
  
  
  
       btnLayout11Back.setOnClickListener(new OnClickListener()       
          {
              public void onClick(View v)
              {
               BackToMain();
  
              }                   
          });  
  
  
       btnLayout11Inq.setOnClickListener(new Button.OnClickListener()
          {
              public void onClick(View v){
  
  
                  URL url;
                  try {
  
                       url = new URL("http://172.0.0.1/mobiwork/mobiftsm.txt");
  
                      HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
  
                      BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream())); 
  
  
  
                      String data;
                      String bkno, fitx, fimtx, option, total;
                      String datatime;
  
  
                      ArrayList&lt;String&gt; arrBKNO = new ArrayList&lt;String&gt;();
                      ArrayList&lt;String&gt; arrFITX = new ArrayList&lt;String&gt;();
                      ArrayList&lt;String&gt; arrFIMTX = new ArrayList&lt;String&gt;();
                      ArrayList&lt;String&gt; arrOPTION = new ArrayList&lt;String&gt;();
                      ArrayList&lt;String&gt; arrTOTAL = new ArrayList&lt;String&gt;();
  
                      arrBKNO.add("據點");
                      arrFITX.add("大台指");
                      arrFIMTX.add("小台指");
                      arrOPTION.add("選擇權");
                      arrTOTAL.add("合    計");
  
                      try {
                            while ((data = in.readLine()) != null) {
  
                                   // 將讀取的 String Line substring 將各欄位填入 StringArray,再進 ListView Adapter:
  
                                      bkno = data.substring(0,4); 
                                      fitx = data.substring(5, 18);
                                      fimtx = data.substring(19,32);
                                      option = data.substring(33,46);
                                      total = data.substring(47,60);
  
  
  
  
                                      if (bkno.equals("1090") == true)                          
                                      {
                                          arrBKNO.add("總公司");
                                      }
                                      else
                                      if (bkno.equals("1091") == true)
                                      {
                                          arrBKNO.add("台中");
                                      }
  
                                      if (bkno.equals("1093") == true)                          
                                      {
                                          arrBKNO.add("埔里");
                                      }
                                      else
                                      if (bkno.equals("1095") == true)
                                      {
                                          arrBKNO.add("桃園");
                                      }
  
                                      if (bkno.equals("1096") == true)                          
                                      {
                                          arrBKNO.add("板橋");
                                      }
                                      else
                                      if (bkno.equals("1097") == true)
                                      {
                                          arrBKNO.add("高雄");                                      
                                      }
                                      else 
                                      if (bkno.equals("109A") == true)
                                      {
                                          arrBKNO.add("城中");
                                      }
                                      else
                                      if (bkno.equals("109K") == true) 
                                      {
                                          arrBKNO.add("忠孝");
                                      }
                                      else 
                                      if (bkno.equals("TOTA") == true)
                                      {  
                                          arrBKNO.add("總計");
                                      }
  
  
  
                                      arrFITX.add(fitx);
                                      arrFIMTX.add(fimtx);
                                      arrOPTION.add(option);
                                      arrTOTAL.add(total);
  
  
  
                              }    // while 迴圈結束
  
                              in.close();     
                      } catch (Exception e) {
                          // TODO: handle exception
                          e.printStackTrace();
                      }
  
  
  
  
  
                      // 設定分公司 lvBKNO ListView 的 ListAdapter      
                      final ArrayAdapter listAdapterBKNO;                    
                      listAdapterBKNO = new ArrayAdapter(MainActivity.this,R.layout.orangetextview,arrBKNO);
                      lvBKNO.setAdapter(listAdapterBKNO);                     
                      lvBKNO.setOnItemClickListener(new OnItemClickListener() {
                          public void onItemClick(AdapterView parent, View view,int position,long id){
                              Toast.makeText(getApplicationContext()," ",Toast.LENGTH_SHORT ).show();                     
                              lvBKNO.setVisibility(view.VISIBLE);                         
                          }               
                      });      
  
  
                      // 設定大台指 lvFITX ListView 的 ListAdapter
                      final ArrayAdapter listAdapterFITX;                    
                      listAdapterFITX = new ArrayAdapter(MainActivity.this,R.layout.mytextview,arrFITX);
                      lvFITX.setAdapter(listAdapterFITX);                     
                      lvFITX.setOnItemClickListener(new OnItemClickListener() {
                          public void onItemClick(AdapterView parent, View view,int position,long id){
                              Toast.makeText(getApplicationContext()," ",Toast.LENGTH_SHORT ).show();                     
                              lvFITX.setVisibility(view.VISIBLE);                         
                          }               
                      }); 
  
                      // 設定小台指 lvFIMTX ListView 的 ListAdapter
                      final ArrayAdapter listAdapterFIMTX;                       
                      listAdapterFIMTX = new ArrayAdapter(MainActivity.this,R.layout.mytextview,arrFIMTX);
                      lvFIMTX.setAdapter(listAdapterFIMTX);                       
                      lvFIMTX.setOnItemClickListener(new OnItemClickListener() {
                          public void onItemClick(AdapterView parent, View view,int position,long id){
                              Toast.makeText(getApplicationContext()," ",Toast.LENGTH_SHORT ).show();                     
                              lvFIMTX.setVisibility(view.VISIBLE);                            
                          }               
                      }); 
  
                   // 設定選擇權 lvOPTION ListView 的 ListAdapter
                      final ArrayAdapter listAdapterOPTION;                      
                      listAdapterOPTION = new ArrayAdapter(MainActivity.this,R.layout.mytextview,arrOPTION);
                      lvOPTION.setAdapter(listAdapterOPTION);                     
                      lvOPTION.setOnItemClickListener(new OnItemClickListener() {
                          public void onItemClick(AdapterView parent, View view,int position,long id){
                              Toast.makeText(getApplicationContext()," ",Toast.LENGTH_SHORT ).show();                     
                              lvOPTION.setVisibility(view.VISIBLE);                           
                          }               
                      });      
  
  
  
                      // 設定合計 lvTOTAL ListView 的 ListAdapter
                      final ArrayAdapter listAdapterTOTAL;                       
                      listAdapterTOTAL = new ArrayAdapter(MainActivity.this,R.layout.mytextview,arrTOTAL);
                      lvTOTAL.setAdapter(listAdapterTOTAL);                       
                      lvTOTAL.setOnItemClickListener(new OnItemClickListener() {
                          public void onItemClick(AdapterView parent, View view,int position,long id){
                              Toast.makeText(getApplicationContext()," ",Toast.LENGTH_SHORT ).show();                     
                              lvTOTAL.setVisibility(view.VISIBLE);                            
                          }               
                      }); 
  
  
  
  
  
                  } catch (Exception e) {
                      // TODO Auto-generated catch block
                      e.printStackTrace();
                  }   
  
          }
  
          }); // 查詢結束
  
      }
  </code></pre>