本文整理汇总了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)));
}