コード例 #1
0
  void saveSessionCookie(ContentResolver cr) {
    HashMap<String, String> cookies = mConnection.getSessionContext();

    int i = 0;
    ContentValues[] valuesList = new ContentValues[cookies.size()];

    for (Map.Entry<String, String> entry : cookies.entrySet()) {
      ContentValues values = new ContentValues(2);

      values.put(Imps.SessionCookies.NAME, entry.getKey());
      values.put(Imps.SessionCookies.VALUE, entry.getValue());

      valuesList[i++] = values;
    }

    cr.bulkInsert(getSessionCookiesUri(), valuesList);
  }