예제 #1
0
 public void handleMessage(Message msg) {
   mValue++;
   mText.setText(Integer.toString(mValue));
   try {
     Thread.sleep(50);
   } catch (InterruptedException e) {;
   }
   if (mValue < 100 && mQuit == false) {
     mProgress.setProgress(mValue);
     mHandler.sendEmptyMessage(0);
   } else {
     dismissDialog(0);
   }
 }
예제 #2
0
  public void run() {
    OfxRequest req = session.newRequest();
    AccountInfoMsgReq acctReq = new AccountInfoMsgReq();
    acctReq.acctListAge = session.profile.acctListAge;
    req.addRequest(acctReq);

    List<OfxMessageResp> response;
    try {
      response = req.submit(this);

      for (OfxMessageResp resp : response) {
        if (resp instanceof AccountInfoMsgResp) {
          AccountInfoMsgResp acctResp = (AccountInfoMsgResp) resp;
          session.profile.acctListAge = acctResp.acctListAge;
          accountList = acctResp.accounts;
        }
      }
    } catch (HttpResponseException e) {
      sendExceptionMsg(QH_ERR_STATUS, e);
    } catch (OfxError e) {
      sendExceptionMsg(QH_ERR_OFX, e);
    } catch (XmlPullParserException e) {
      sendExceptionMsg(QH_ERR_PARSE, e);
    } catch (SSLPeerUnverifiedException e) {
      sendExceptionMsg(QH_ERR_SSL_VERIFY, e);
    } catch (ClientProtocolException e) {
      sendExceptionMsg(QH_ERR_HTTP, e);
    } catch (ConnectException e) {
      sendExceptionMsg(QH_ERR_TIMEOUT, e);
    } catch (SocketException e) {
      sendExceptionMsg(QH_ERR_CONN, e);
    } catch (SSLException e) {
      sendExceptionMsg(QH_ERR_SSL, e);
    } catch (Exception e) {
      sendExceptionMsg(QH_ERR, e);
    }

    ProfileTable db = new ProfileTable(this);
    try {
      db.openWritable();
      db.syncAccounts(session, accountList);
    } catch (SQLiteException e) {
      sendExceptionMsg(QH_ERR, e);
    } finally {
      db.close();
    }

    queryHandler.sendEmptyMessage(QH_OK);
  }