Ejemplo n.º 1
0
  public static ContentValues getContentValues(Tweet tweet) {

    if (tweet.getCreationDate() == null) {
      tweet.setCreationDate(new Date());
    }

    if (tweet.getModificationDate() == null) {
      tweet.setModificationDate(new Date());
    }

    ContentValues content = new ContentValues();
    content.put(KEY_TWEET_TEXT, tweet.getText());
    content.put(KEY_TWEET_CREATION_DATE, DBHelper.convertDateToLong(tweet.getCreationDate()));
    content.put(
        KEY_TWEET_MODIFICATION_DATE, DBHelper.convertDateToLong(tweet.getModificationDate()));
    content.put(KEY_TWEET_IMAGE_URL, tweet.getImageURL());
    content.put(KEY_TWEET_LATITUDE, String.format("%f", tweet.getLatitude()));
    content.put(KEY_TWEET_LONGITUDE, String.format("%f", tweet.getLongitude()));

    return content;
  }