how make simpler expresion for showing multiple recyclerview in one activty : i try to make multiple recyclerview divided by textview in each recyclerview, thi code work for me but i want to make code simpler than before can anyone help me?

here is my activity java

        public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

        ((MainActivity) getActivity()).setActionBarTitle("Tuntunan Toharoh");

        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_home, container, false);

        //=============================================================
        mRecyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
        mRecyclerView.setHasFixedSize(true);

        RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity());
        mRecyclerView.setLayoutManager(layoutManager);

        mRecyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), LinearLayoutManager.VERTICAL));
        RecyclerView.Adapter tadapter = new RecyclerViewAdapter(getActivity(), mRecyclerViewItems);
        mRecyclerView.setAdapter(tadapter);
        addMenuItemsFromJson();
        mRecyclerView.setNestedScrollingEnabled(false);

        //=========================================================
        DzRecyclerView2 = (RecyclerView) view.findViewById(R.id.recycler_submenu);
        DzRecyclerView2.setHasFixedSize(true);

        RecyclerView.LayoutManager zlayoutManager = new LinearLayoutManager(getActivity());
        DzRecyclerView2.setLayoutManager(zlayoutManager);

        RecyclerView.Adapter zadapter = new RecyclerViewAdapter(getActivity(), mRecyclerViewItems2);
        DzRecyclerView2.setAdapter(zadapter);
        addMenuItemsFromJson2();
        DzRecyclerView2.setNestedScrollingEnabled(false);

        //=========================================================
        DzaRecyclerView3 = (RecyclerView) view.findViewById(R.id.recycler_mandi);
        DzaRecyclerView3.setHasFixedSize(true);

        RecyclerView.LayoutManager zzlayoutManager = new LinearLayoutManager(getActivity());
        DzaRecyclerView3.setLayoutManager(zzlayoutManager);

        RecyclerView.Adapter ziadapter = new RecyclerViewAdapter(getActivity(), mRecyclerViewItems3);
        DzaRecyclerView3.setAdapter(ziadapter);
        addMenuItemsFromJson3();
        DzaRecyclerView3.setNestedScrollingEnabled(false);
        //=========================================================

        return view;


    private void addMenuItemsFromJson() {
        try {
            String jsonDataString = readJsonDataFromFile();
            JSONArray menuItemsJsonArray = new JSONArray(jsonDataString);

            for (int i = 0; i < menuItemsJsonArray.length(); ++i) {

                JSONObject menuItemObject = menuItemsJsonArray.getJSONObject(i);

                String menuItemtitle = menuItemObject.getString("title");
                String menuItemContent = menuItemObject.getString("content");

                DafAdapter dafa = new DafAdapter(menuItemtitle, menuItemContent);
                mRecyclerViewItems.add(dafa);
            }
        } catch (IOException | JSONException exception) {
            Log.e(MainActivity.class.getName(), "Unable to parse JSON file.", exception);
        }
    }


    private String readJsonDataFromFile() throws IOException {

        InputStream inputStream = null;
        StringBuilder builder = new StringBuilder();

        try {
            String jsonDataString = null;
            inputStream = getResources().openRawResource(R.raw.tayamum);
            BufferedReader bufferedReader = new BufferedReader(
                    new InputStreamReader(inputStream, "UTF-8"));
            while ((jsonDataString = bufferedReader.readLine()) != null) {
                builder.append(jsonDataString);
            }
        } finally {
            if (inputStream != null) {
                inputStream.close();
            }
        }

        return new String(builder);
    }

    private void addMenuItemsFromJson2() {
        try {
            String jsonDataString = readJsonDataFromFile2();
            JSONArray menuItemsJsonArray = new JSONArray(jsonDataString);

            for (int i = 0; i < menuItemsJsonArray.length(); ++i) {

                JSONObject menuItemObject = menuItemsJsonArray.getJSONObject(i);

                String menuItemtitle = menuItemObject.getString("title");
                String menuItemContent = menuItemObject.getString("content");

                DafAdapter dafa = new DafAdapter(menuItemtitle, menuItemContent);
                mRecyclerViewItems2.add(dafa);
            }
        } catch (IOException | JSONException exception) {
            Log.e(MainActivity.class.getName(), "Unable to parse JSON file.", exception);
        }
    }

    private String readJsonDataFromFile2() throws IOException {

        InputStream inputStream = null;
        StringBuilder builder = new StringBuilder();

        try {
            String jsonDataString = null;
            inputStream = getResources().openRawResource(R.raw.wudhu);
            BufferedReader bufferedReader = new BufferedReader(
                    new InputStreamReader(inputStream, "UTF-8"));
            while ((jsonDataString = bufferedReader.readLine()) != null) {
                builder.append(jsonDataString);
            }
        } finally {
            if (inputStream != null) {
                inputStream.close();
            }
        }

        return new String(builder);
    }
    private void addMenuItemsFromJson3() {
        try {
            String jsonDataString = readJsonDataFromFile3();
            JSONArray menuItemsJsonArray = new JSONArray(jsonDataString);

            for (int i = 0; i < menuItemsJsonArray.length(); ++i) {

                JSONObject menuItemObject = menuItemsJsonArray.getJSONObject(i);

                String menuItemtitle = menuItemObject.getString("title");
                String menuItemContent = menuItemObject.getString("content");

                DafAdapter dafa = new DafAdapter(menuItemtitle, menuItemContent);
                mRecyclerViewItems3.add(dafa);
            }
        } catch (IOException | JSONException exception) {
            Log.e(MainActivity.class.getName(), "Unable to parse JSON file.", exception);
        }
    }

    private String readJsonDataFromFile3() throws IOException {

        InputStream inputStream = null;
        StringBuilder builder = new StringBuilder();

        try {
            String jsonDataString = null;
            inputStream = getResources().openRawResource(R.raw.mandi);
            BufferedReader bufferedReader = new BufferedReader(
                    new InputStreamReader(inputStream, "UTF-8"));
            while ((jsonDataString = bufferedReader.readLine()) != null) {
                builder.append(jsonDataString);
            }
        } finally {
            if (inputStream != null) {
                inputStream.close();
            }
        }

        return new String(builder);
    }


if i want to add one or more recyclerview it just make similar expression just change expression 1 to others. i think it can be change and more simpler than i use here.


maybe using **switch or if** i have tried but no luck for code, thanks