badge layout & sqlite get b_id/b_type