2017-08-19 3 views
1

アプリがバックグラウンドに移行したり、デバイス画面がオフになっても接続を呼び出すことができます。私はonStopメソッドは、画面が消えたときに動作すると思います。私はstop()メソッドでタイマーの内部でconnectionRequestを呼び出しましたが、動作していません。停止ライフサイクルメソッドでの接続呼び出し

public void start() { 
    if (current != null) { 
     current.show(); 
     return; 
    } 

    hi = new Form("My app", BoxLayout.y()); 
    hi.show(); 
} 

public void stop() { 
    new UITimer(new Runnable() { 
     public void run() { 
      System.out.println("fghfhfghgf "); 
      Connection c = new Connection(); 
      c.connectionMethod(); 
     } 
    }).schedule(10000, true, hi); 
    current = getCurrentForm(); 
    if (current instanceof Dialog) { 
     ((Dialog) current).dispose(); 
     current = getCurrentForm(); 
    } 
} 

答えて

関連する問題