Android Exception: UnknownFormatConversionException -
hi setting text inside robototext positioned inside of viewholder calling this:
viewholder.txtsimilarads.settext((((property) ads.get(position)).getsimilar_items_count() == 1 ? context.getstring(r.string.ad_data_similar) : context.getstring(r.string.ad_data_similar_plural, ads.get(position).getimagescount())));
however (sometimes not always)for reason keep getting error exception unknownformatconversionexception , points line inside of class. problem? doing wrong?
check string in r.string.ad_data_similar_plural
contains valid placeholder integer. should "here number: %d"
.
as aside, one-liner these harder understand, , make debugging more difficult. more readable approach have given erroneous line more easily:
string similaradstext; property adsproperty = ads.get(position); if (adsproperty.getsimilar_items_count() == 1) { similaradstext = context.getstring(r.string.ad_data_similar); } else { similaradstext = context.getstring(r.string.ad_data_similar_plural, adsproperty.getimagescount()); } viewholder.txtsimilarads.settext(similaradstext);
Comments
Post a Comment