多次编译后ArrayList标题混乱

时间:2019-06-17 22:28:54

标签: java android realm

我已经创建了一个领域列表并将其保存到我的主要对象中。此列表显示在recyclerview中。它工作正常,但经过一些编译后,它弄乱了我用作标题的字符串的引用。一切正常(我得到了图标,状态和一些其他标志),但是显示的文本与我在该特定位置插入的文本不对应。

我不想直接使用文本,因为标题在代码的其他部分中使用了。我已经调试了代码,但是没有看到问题。

private RealmList<ItemMenu> getClaimMenu(String folio) {
    RealmList<ItemMenu> mClaimMenuItems = new RealmList<>();
    mClaimMenuItems.clear();
    mClaimMenuItems.add(new ItemMenu(ItemMenuConstants.PRIVACY_NOTICE, R.string.menu_item_0, R.drawable.ico__tab_avispriv, ItemMenuConstants.UNSTARTED, folio));
    mClaimMenuItems.add(new ItemMenu(ItemMenuConstants.CLAIM, R.string.menu_item_1, R.drawable.ico__tab_siniest, ItemMenuConstants.UNSTARTED, folio));
    mClaimMenuItems.add(new ItemMenu(ItemMenuConstants.POLICY, R.string.menu_item_2, R.drawable.ico__tab_poliza, ItemMenuConstants.UNSTARTED, folio));
    mClaimMenuItems.add(new ItemMenu(ItemMenuConstants.INSURED, R.string.menu_item_3, R.drawable.ico__tab_aseg, ItemMenuConstants.UNSTARTED, folio));
    mClaimMenuItems.add(new ItemMenu(ItemMenuConstants.INVOLVED, R.string.menu_item_6, R.drawable.ico__tab_involuc, ItemMenuConstants.UNSTARTED, folio));
    mClaimMenuItems.add(new ItemMenu(ItemMenuConstants.VEHICLE, R.string.menu_item_5, R.drawable.ico__tab_vehic, ItemMenuConstants.UNSTARTED, folio));
    //            mClaimMenuItems.add(new ItemMenu(ItemMenuConstants.DRIVER,R.string.menu_item_4, R.drawable.ico__tab_conduct, ItemMenuConstants.UNSTARTED,folio));
    //            mClaimMenuItems.add(new ItemMenu(ItemMenuConstants.STATEMENT,R.string.menu_item_7, R.drawable.ico__tab_narrat, ItemMenuConstants.UNSTARTED,folio));
    mClaimMenuItems.add(new ItemMenu(ItemMenuConstants.DAMAGE, R.string.menu_item_8, R.drawable.ico__tab_choque, ItemMenuConstants.UNSTARTED, folio, ItemMenuConstants.DISABLE));
    mClaimMenuItems.add(new ItemMenu(ItemMenuConstants.CIRCUMSTANCE, R.string.menu_item_9, R.drawable.ico__tab_circuns, ItemMenuConstants.UNSTARTED, folio, ItemMenuConstants.DISABLE));
    mClaimMenuItems.add(new ItemMenu(ItemMenuConstants.PHOTO, R.string.menu_item_10, R.drawable.ico__tab_fotos, ItemMenuConstants.UNSTARTED, folio));
    mClaimMenuItems.add(new ItemMenu(ItemMenuConstants.SKETCH, R.string.menu_item_11, R.drawable.ico__tab_croquis, ItemMenuConstants.UNSTARTED, folio, ItemMenuConstants.DISABLE));
    mClaimMenuItems.add(new ItemMenu(ItemMenuConstants.SHARE, R.string.menu_item_12, R.drawable.ico__tab_compinfo, ItemMenuConstants.UNSTARTED, folio, ItemMenuConstants.DISABLE));
    mClaimMenuItems.add(new ItemMenu(ItemMenuConstants.DOCUMENTS, R.string.menu_item_13, R.drawable.ico__tab_genord, ItemMenuConstants.UNSTARTED, folio, ItemMenuConstants.DISABLE));
    mClaimMenuItems.add(new ItemMenu(ItemMenuConstants.FINISH, R.string.menu_item_14, R.drawable.ico__tab_termino, ItemMenuConstants.UNSTARTED, folio));
    mClaimMenuItems.add(new ItemMenu(ItemMenuConstants.REPORT, R.string.menu_item_16, R.drawable.ico__tab_infajust, ItemMenuConstants.UNSTARTED, folio));
    mClaimMenuItems.add(new ItemMenu(ItemMenuConstants.CANCEL, R.string.menu_item_15, R.drawable.ico__tab_cancel, ItemMenuConstants.UNSTARTED, folio, ItemMenuConstants.WARNING));

    return mClaimMenuItems;
}


class ItemMenu extends RealmObject{
    @PrimaryKey
    private String _uuid;
    private int title;
    private int id;
    private int icon;
    private int badges;
    private int status;
    private int visibility;
    private String claimId;
    ...
}```

Instead of displaying R.string.menu_item_0 at position 0, it displays R.string.menu_item_10 , and in position 1 it doesn't show R.string.menu_item_1 but R.string.menu_item_0. The same happens to all items displayed. 

This, I repeat, happens after lots of compilations later.

0 个答案:

没有答案