In the onBindViewHolder method onBindViewHolder add the following:

 viewHolder.date.setText(moviesList.get(i).getTime()); 

Below added

 public class ViewHolder extends RecyclerView.ViewHolder { private TextView date; public ViewHolder(View view) { super(view); date=(TextView) view.findViewById(R.id.date); 

But when starting it gives an error:

android.content.res.Resources $ NotFoundException: Unable to find resource ID # 0x58318fae

I do not quite understand what id he does not find, in xml? So he is there.

    1 answer 1

    Apparently .getTime() returns a number from you and, thus, you are trying to use an overloaded version of the TextView#setText(@StringRes int resId) method TextView#setText(@StringRes int resId) that is trying to find a line with the passed ID in the resources that it does not find and reports.

    You need to use an overloaded variant of the method that accepts a string. Those. convert data to string. For example:

     viewHolder.date.setText(String.valueof(moviesList.get(i).getTime())); 
    • Thanks, it was displayed, but somehow it is not entirely correct. The fact is that I have in the API model of Creation date of the item, in Unix Time. Is it possible to convert it into the necessary format? do not tell me? - Inkognito
    • one
      @Inkognito, Yes you can . - post_zeew
    • @Inkognito, create a Date object using the Date(long unixTimeInMillis) constructor Date(long unixTimeInMillis) - Juriy Spb
    • @Yuriy SPb and if we try to call this parameter in another activity, what should be added to textView.setText (model.getTime ()); ? - Inkognito
    • one
      Try adding .toString () at the end - Morozov