Thursday, 15 May 2014

java - Why doesn't my delay happen? -


Currently developing an app where I need to take several WiFi measurements, take the average of these measurements and Collect average however I have found that I have to implement a delay between measurement otherwise there is not enough time to see any difference between the measurement.

In the Handler.postDelayed () method, I have tried to implement the delay of 2000ms, however, when I look at the Timestamp of the logs generated by Sakthi, there is no delay.

Any help would be greatly appreciated :)

  @Override protected void onCreate {bundled saved instenstate} {super.onCreate (SavedInstanceState); SetContentView (R.layout.activity_takewifi); Last string [] strArr = new string [60]; For {i.e. I / O; i ++;} {strarr [i] = "blank"; } WiFi Manager WiFi = (WiFi Manager) Receive System System (Ref. WIFI_SERVICE); Final integer = wifi.getWifiState (); If (state == wifi manager.WIFI_STATE_ENABLED) {rodata rd = new radata (); Toast. Maketext (Takewee, "Take RSS Measure, Still Stop!", Toast. LNNGHHORT). Show (); For (int a = 0; a & lt; 30; a ++) {wifi.startScan (); Last Handler Handler = New Handler (); Handler Post (New Runnabal) ({Overwrite Public Wide Run) ({handler.post Delayed (This, 2000);}}); & Lt; ScanResult & gt; Results = wifi.getScanResults (); String index = (string) results.toString (); Int = 0 for; Int ifCount = 0; For (string rate: index. Split (",")) {if (((count% 5 == 1) || (count% 5 == 3)) & amp; amp; amp; (Ifcount & lt; 60)) {strarr [IfCount] = Rival; Strarr [ifCount] = strarr [ifCount] .replace ("bssid:", "bssID:"); Strarr [ifCount] = strarr [ifCount] .replace ("Level:", "Level:"); Ifcount ++; } Count ++; } For (int check = 0; check & lt; 60; check ++) {log d. ("Taqui", "Strachar [" + Czech + "]:" + Strat [check]); } RD.SetsTrar (Straur, RD); } Last string [] temp = rD.getStrArr (rd); For (int b = 0; b & lt; 20; b ++) {strarr [b] = temp [b]; } (Int i = 0; i  

Change your handle with this and whatever you want to delay it.

  new handler (). Post Deliad (new Rnnabl () {@Override public void run ()} / / / you need to go inside her Rnnbl who want to delay}}, 2000);  

No comments:

Post a Comment