Beispiel #1
0
  private synchronized void resetClient() {
    client = null;

    try {
      service.removeAccount(listener);
      service.registerAccount(
          prefs.getString("user", ""), prefs.getString("password", ""), listener);
    } catch (Throwable t) {
      Log.e("Patchy", "Exception in resetClient()", t);
      goBlooey(t);
    }
  }
Beispiel #2
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == R.id.prefs) {
      startActivity(new Intent(this, EditPreferences.class));

      return (true);
    } else if (item.getItemId() == R.id.bff) {
      try {
        List<String> bff = new ArrayList<String>();

        for (int i = 0; i < friends.size(); i++) {
          if (friendsList.isItemChecked(i)) {
            bff.add(friends.get(i));
          }
        }

        service.setBestFriends(listener, bff);
      } catch (Throwable t) {
        Log.e("Patchy", "Exception in onOptionsItemSelected()", t);
        goBlooey(t);
      }

      return (true);
    } else if (item.getItemId() == R.id.location) {
      insertLocation();

      return (true);
    } else if (item.getItemId() == R.id.help) {
      startActivity(new Intent(this, HelpPage.class));

      return (true);
    }

    return (super.onOptionsItemSelected(item));
  }
Beispiel #3
0
        public void onServiceConnected(ComponentName className, IBinder binder) {
          service = ITwitterMonitor.Stub.asInterface(binder);

          try {
            service.registerAccount(
                prefs.getString("user", null), prefs.getString("password", null), listener);
          } catch (Throwable t) {
            Log.e("Patchy", "Exception in call to registerAccount()", t);
            goBlooey(t);
          }
        }
Beispiel #4
0
  @Override
  public void onDestroy() {
    super.onDestroy();

    locMgr.removeUpdates(onLocationChange);

    try {
      if (service != null) {
        service.removeAccount(listener);
      }
    } catch (Throwable t) {
      Log.e("Patchy", "Exception in call to removeAccount()", t);
      goBlooey(t);
    }

    unbindService(svcConn);
  }