Esempio n. 1
0
    public void run() {
      Message msg = new Message();
      msg.arg2 = REQUEST_FRIENDS_TIMELINE;
      try {
        TwitterResponse statuses = twitter.getFriendsTimeline();

        // Load and cache all profile bitmaps
        BitmapCache cache = BitmapCache.getInstance();
        for (int i = 0; i < statuses.getNumberOfItems(); i++)
          cache.load(statuses.getItemAt(i).getUser().getProfileImageURL());

        msg.arg1 = RESPONSE_OK;
        msg.obj = statuses;
      } catch (TwitterConnectionException e) {
        msg.arg1 = RESPONSE_CONN_KO;
        msg.obj = e;
      } catch (Exception e) {
        msg.arg1 = RESPONSE_KO;
        msg.obj = e;
      }
      handler.sendMessage(msg);
    }