Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_additives_explorer); recyclerView = findViewById(R.id.additiveRecyclerView); progressBar = findViewById(R.id.additives_progress_bar); fastScroller = findViewById(R.id.additives_fast_scroller); progressBar.setVisibility(View.VISIBLE); OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("<LINK_0>") .build(); <START> <END> client.newCall(request).enqueue(new Callback() { @Override public void onFailure(Call call, IOException e) { } @Override public void onResponse(Call call, Response response) throws IOException { final String myResponse = response.body().string(); List<Additives> names = new ArrayList<>(); try { names = parseJson(myResponse); } catch (JSONException e) { e.printStackTrace(); } final List<Additives> additives = names; AdditivesExplorer.this.runOnUiThread(new Runnable() { @Override public void run() { progressBar.setVisibility(View.INVISIBLE); recyclerView.setLayoutManager(new LinearLayoutManager(AdditivesExplorer.this)); recyclerView.setAdapter(new AdditivesAdapter(additives, AdditivesExplorer.this)); recyclerView.addItemDecoration(new DividerItemDecoration(AdditivesExplorer.this, DividerItemDecoration.VERTICAL)); fastScroller.setVisibility(View.VISIBLE); fastScroller.setRecyclerView(recyclerView); } }); } }); }</code><technical_language>@PrajwalM2212 is need for downloading data everytime additivies stored in local database in AdditiveNmaeDao extract data getAdditiveByTagAndLanguageCode function in ProductRepository.java this takes care of translations. this code compact</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_additives_explorer); recyclerView = findViewById(R.id.additiveRecyclerView); productRepository = ProductRepository.getInstance(); toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setTitle("Additives"); additiveNameDao = Utils.getAppDaoSession(this).getAdditiveNameDao(); List<AdditiveName> additivesNames = additiveNameDao.loadAll(); String languageCode = Locale.getDefault().getLanguage(); additives = new ArrayList<>(); Set<AdditiveName> hs = new HashSet<>(); for (int i = 0; i < additivesNames.size(); i++) { if (additivesNames.get(i).getName().startsWith("E")) { String tag = additivesNames.get(i).getAdditiveTag(); hs.add(productRepository.getAdditiveByTagAndLanguageCode(tag, languageCode)); } } additives.addAll(hs); Collections.sort(additives, new Comparator<AdditiveName>() { @Override public int compare(AdditiveName additiveName, AdditiveName t1) { String s1 = additiveName.getName().toLowerCase().replace('x', '0').split("(?<=\\D)(?=\\d)|(?<=\\d)(?=\\D)")[1]; String s2 = t1.getName().toLowerCase().replace('x', '0').split("(?<=\\D)(?=\\d)|(?<=\\d)(?=\\D)")[1]; return Integer.valueOf(s1).compareTo(Integer.valueOf(s2)); } }); recyclerView.setLayoutManager(new LinearLayoutManager(AdditivesExplorer.this)); recyclerView.setAdapter(new AdditivesAdapter(additives, AdditivesExplorer.this)); recyclerView.addItemDecoration(new DividerItemDecoration(AdditivesExplorer.this, DividerItemDecoration.VERTICAL)); }