本文整理匯總了Java中com.parse.ParseObject.getCreatedAt方法的典型用法代碼示例。如果您正苦於以下問題:Java ParseObject.getCreatedAt方法的具體用法?Java ParseObject.getCreatedAt怎麽用?Java ParseObject.getCreatedAt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.parse.ParseObject
的用法示例。
在下文中一共展示了ParseObject.getCreatedAt方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getView
import com.parse.ParseObject; //導入方法依賴的package包/類
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
convertView = LayoutInflater.from(mContext).inflate(R.layout.message_item, null);
holder = new ViewHolder();
holder.iconImageView = (ImageView)convertView.findViewById(R.id.messageIcon);
holder.nameLabel = (TextView)convertView.findViewById(R.id.senderLabel);
holder.timeLabel = (TextView)convertView.findViewById(R.id.timeLabel);
convertView.setTag(holder);
}
else {
holder = (ViewHolder)convertView.getTag();
}
ParseObject message = mMessages.get(position);
Date createdAt = message.getCreatedAt();
long now = new Date().getTime();
String convertedDate = DateUtils.getRelativeTimeSpanString(
createdAt.getTime(),
now,
DateUtils.SECOND_IN_MILLIS).toString();
holder.timeLabel.setText(convertedDate);
if (message.getString(ParseConstants.KEY_FILE_TYPE).equals(ParseConstants.TYPE_IMAGE)) {
holder.iconImageView.setImageResource(R.drawable.ic_picture);
}
else {
holder.iconImageView.setImageResource(R.drawable.ic_video);
}
holder.nameLabel.setText(message.getString(ParseConstants.KEY_SENDER_NAME));
return convertView;
}
示例2: notifyTextMessageSent
import com.parse.ParseObject; //導入方法依賴的package包/類
private void notifyTextMessageSent(@NonNull ParseObject msg, @NonNull String conversationId) {
final long messageTimestamp = msg.getCreatedAt() != null ? msg.getCreatedAt().getTime() : 0;
mLastMessageTimestamp = Math.max(messageTimestamp, mLastMessageTimestamp);
// Publish the real message back to the listening presenter layer after it is successfully saved (so that it can replace the temporary message)
mUpdatePublisher.onNext(new Update<>(conversationId, Update.Action.UPDATED, null, ParseUtils.from(msg, mParseHelper)));
}