Example #1
0
  /**
   * Write parcelable object
   *
   * @param dest The Parcel in which the object should be written
   * @param flags Additional flags about how the object should be written
   */
  public void writeToParcel(Parcel dest, int flags) {
    dest.writeLong(timestamp);
    dest.writeString(status);
    dest.writeString(freetext);

    if (favoriteLink != null) {
      dest.writeByte((byte) 1);
      favoriteLink.writeToParcel(dest, flags);
    } else {
      dest.writeByte((byte) 0);
    }

    if (photo != null) {
      dest.writeByte((byte) 1);
      photo.writeToParcel(dest, flags);
    } else {
      dest.writeByte((byte) 0);
    }

    if (geoloc != null) {
      dest.writeByte((byte) 1);
      geoloc.writeToParcel(dest, flags);
    } else {
      dest.writeByte((byte) 0);
    }
  }
Example #2
0
 /**
  * Returns a string representation of the object
  *
  * @return String
  */
 public String toString() {
   String result =
       "- Timestamp: "
           + timestamp
           + "\n"
           + "- Status: "
           + status
           + "\n"
           + "- Freetext: "
           + freetext
           + "\n";
   if (favoriteLink != null) {
     result += "- Favorite link: " + favoriteLink.toString() + "\n";
   }
   if (photo != null) {
     result += "- Photo-icon: " + photo.toString() + "\n";
   }
   if (geoloc != null) {
     result += "- Geoloc: " + geoloc.toString() + "\n";
   }
   return result;
 }