エラーキャッチ改善

This commit is contained in:
rca 2024-07-06 12:02:33 +09:00
parent 7ae8a5559f
commit 9f8c9690b8

View File

@ -118,7 +118,17 @@ public class SettingMainFragment extends Fragment {
}).thenAccept(childModels -> {
mainAdapter.setChildDataList(childModels);
requireActivity().runOnUiThread(() -> {
mainAdapter.notifyDataSetChanged();
try {
mainAdapter.notifyItemRangeInserted(0, childModels.size());
} catch (IndexOutOfBoundsException e) {
try {
mainAdapter.notifyDataSetChanged();
} catch (Exception e1) {
Toast.makeText(requireContext(), "エラーが発生しました", Toast.LENGTH_SHORT).show();
}
} catch (Exception e) {
Toast.makeText(requireContext(), "エラーが発生しました", Toast.LENGTH_SHORT).show();
}
});
});